Export results from the Query editor which can be consumed by Excel?

245    Asked by DanPeters in Salesforce , Asked on Aug 24, 2023

 I use the Query Editor in the SFDC developer console. I can replicate the DemandTools and other tools’ functionality. But when I ask a query for debugging, exporting the results or utilizing it becomes problematic. Can I use any way to export the result’s table as Excel/JSON/CSV in a format that Excel can use? 

Answered by Danna sahi

 First of all, the Developer Workbench can help you to build SOQL queries and save the results as CSV. Also, the Script opens a window with raw data present as a downloadable link in a CSV file and CSV format. Follow the steps if you can:

1. Choose the tab you need to export.

2. Now, press F12 and navigate to the console.

3. You will get a link. Copy and paste that and click enter. Allow to pop a window.

var o = document.evaluate("//div[@id='editors-body']/div[not(contains(@style,'display:none') or contains(@style,'display: none'))]//table/tbody/tr",document,null,0,null);
var r = [];
while(row = o.iterateNext()){
    var cols = row.getElementsByTagName('td');
    var a = [];
    for(var i=0; i/g);
    var output = output.replace(regexp, "");
    if (output == "") return '';
    return '"' + output + '"';
}
// showing data in the window for copy/ paste
function popup(data) {
    var generator = window.open('', 'csv', 'height=400,width=600');
    generator.[removed]('CSV');
    generator.[removed]('');
    generator.[removed]('Download CSV');
    generator.[removed]('');
    generator.[removed](data);
    generator.[removed]('');
    generator.[removed]('');
    generator.document.close();
    return true;
}

There is another solution too. You can also follow the below-mentioned steps:

1. Go to the console and get some query records to get salesforce developer console export query results.

2. Now, open the FireBug window and select the query results table using the FireBug’s select arrow.

3. Turn off the css style (-moz-user-select: none) for (

4. Select results and copy and paste the result into Excel.



Your Answer

Interviews

Parent Categories