Pages

Thursday, January 7, 2021

Salesforce: Export Query Result from Developer Console

In case you have no access to the workbench, can we download the query result from the Developer Console?


Build a Query in Developer Console

Open Developer Console, File > Open > Objects > select an object > click Open (or double click the object name). 


Select the fields by hold the Ctrl key (and Shift key) for Windows users, then hit the Query button, Id field will be auto-added.

Click the Execute button, developer console will open a tab with the query result.



Export query result to Excel file

This is tested in Chrome and chromium-based web engines (such as Edge and Opera), so not sure for Firefox and Safari.

Right-click on the query result and select Inspect.


Look for the table tag, then do "Copy element".


Open Excel and Paste to get the result.




 

13 comments:

  1. Thank you but the "Copy element" doesn't work because when I tried to Paste it into Excel, it includes the HTML tags. None of the other Copy/Paste options worked. Could you please clarify the Excel version and the exact Paste option you're choosing. I ended up doing the query in the Workbench and exporting as CSV but I may not always have access to the workbench, so this could be very helpful to someone. I hope Salesforce will add this functionality out of the box someday.

    ReplyDelete
    Replies
    1. I just try and it works, it is simply a copy and paste.
      I am using Microsoft Excel version 2102 (Build 13801)

      Delete
  2. It took me a good 15 tries (and because I am stubborn, I kept doing it over and over and over again). I honestly don't know what I did differently the last time because, come on, this is copy and paste. But it didn't work the first bunch of times.

    ReplyDelete
    Replies
    1. assume you manage to get it works!

      Delete
    2. I did. Thank you for this information. Very helpful.

      Delete
    3. awesome, glad to hear it 😊

      Delete
  3. Johan, this article was very helpful for me and your outlined solution worked for me.
    Thank You!

    ReplyDelete
  4. Is it just me or does it only grab the first 2,000 records?

    ReplyDelete
    Replies
    1. I am not sure how to get more 2K in Developer Console query editor, but you can use workbench to get all records https://workbench.developerforce.com/login.php

      Delete
  5. Use workbench application and download it as excel.

    ReplyDelete
  6. Thank you for posting this. Works perfectly.

    ReplyDelete

Page-level ad