Resources /
Blog

How to Export Query Results from Salesforce Developer Console

Submit your details to get a book

Min Read
Resources /
Blog

How to Export Query Results from Salesforce Developer Console

Download

Submit your details to get a book

Min Read

The Salesforce Developer Console cannot export query results to a file. There is no export button and no right-click download in the Query Editor: you can select and copy what is on screen, but producing a real CSV requires a different tool. For small result sets, copy the grid into a spreadsheet. For anything larger or repeatable, use Data Loader, SOQL Builder, or the Salesforce CLI.

This guide covers how to run a SOQL query in the Developer Console, then five ways to get those results into a file, with the limits and permissions for each.

Can You Export Query Results Directly from Salesforce Developer Console?

No. This is the single most common misunderstanding about the tool, so it is worth being precise about what is and is not possible.

What you can do is select rows in the results grid and copy them to your clipboard, then paste into Excel or Google Sheets. That is a manual copy, not an export. It has no file format, no encoding control, and no way to schedule or repeat it.

What you cannot do is generate a CSV from the Console itself. The Query Editor is a development and debugging tool, not a data extraction tool. Its results grid is also capped, commonly reported at around 2,000 rows, so even the copy approach breaks down on larger datasets. If you need a file, you need one of the methods below.

What Is the Salesforce Developer Console Query Editor?

The Developer Console is a browser-based development environment for editing Apex, viewing debug logs, and inspecting data. The Query Editor is the panel at the bottom where you write and execute SOQL against your org and see results in a grid.

When to use it: the Query Editor is the fastest way to check whether a query returns what you expect, validate a filter before putting it into Apex, or spot-check a handful of records after a data change. It is built for inspection, and it is excellent at that. It is not built for extraction, which is why the rest of this guide exists.

How to Run a SOQL Query in Salesforce Developer Console

Open the Developer Console and Query Editor

  1. Click the gear icon in the upper right of Salesforce, then select Developer Console. It opens in a new browser window.
  2. At the bottom of the window, select the Query Editor tab.

Enter and Execute Your SOQL Query

  1. Type or paste your SOQL into the Query Editor field. A simple example to start with:
SOQL
SELECT Id, Name, Industry, BillingCity, CreatedDate
FROM Account
WHERE CreatedDate = LAST_N_DAYS:30
ORDER BY CreatedDate DESC

4. Click Execute. Results appear in the grid below, with one column per field you selected.

If the query errors, check that every field name is spelled correctly and exists on the object, and that you have read access to each one. Results reflect what your user can see, not everything in the org.

How to Export Query Results from Salesforce Developer Console

Five methods, ordered from simplest to most robust. All except the last are officially supported by Salesforce.

Method 1: Copy Small Query Results into Excel

Best for a handful of rows you need right now.

5. Run your query in the Query Editor.

6. Click the first cell in the results grid, then shift-click the last cell to select the range.

7. Press Ctrl+C (Cmd+C on Mac).

8. Paste into Excel or Google Sheets, then save as .csv if you need a file.

Column headers may not come across cleanly, and formatting is unreliable for long text or fields containing commas. Treat this as a quick lift, not a repeatable process.

Method 2: Export the SOQL Results with Data Loader

Best for large exports and anything you need as a proper CSV. Data Loader is a supported Salesforce client application and handles far more rows than the Console displays.

9. Open Data Loader and click Export. (Use Export All if you also need records in the Recycle Bin.)

10. Log in and select your org environment.

11. .Choose the object you are querying, then pick a destination and filename for the CSV.

12. Select the fields you want, or switch to the SOQL editor and paste your query directly.

13. Click Finish to run the extraction, then open the CSV to confirm the row count matches what you expected.

Data Loader uses the API, so the running user needs the API Enabled permission plus read access to the object and every field in the query.

Method 3: Save Results with SOQL Builder

Best if you already work in VS Code. SOQL Builder ships with the Salesforce Extension Pack and is the closest thing to a genuine one-click export among the supported tools.

14. Install the Salesforce Extension Pack in VS Code and authorise your org.

15. Create or open a file with a .soql extension, then open it in SOQL Builder.

16. Build your query visually, or paste existing SOQL into the text editor and toggle between the two views.

17. Run the query to see results in the panel below.

18. Click one of the Save icons on the results panel to save the output as a .csv or .json file.

Add your saved output paths to .gitignore so exported data does not end up committed to source control or deployed to an org.

Method 4: Export with Salesforce CLI

Best for recurring or scripted exports. Because it runs from the command line, it can be scheduled or dropped into a pipeline.

19. Install Salesforce CLI and authorise your org.

20. Run your query with a CSV result format and redirect the output to a file, for example:

Bash
sf data query \
  --query "SELECT Id, Name, Industry FROM Account" \
  --result-format csv > accounts.csv

21. Open the resulting file to verify the rows and headers.

One limitation worth knowing: Salesforce notes that the CLI does not currently support bulk queries, so very large result sets are better handled by Data Loader.

Legacy Option: Export with Workbench

Use with caution. Workbench can run a SOQL query and download results as CSV, and many admins still reach for it out of habit. It is no longer a sensible default. Salesforce publishes replacement guidance for Workbench stating that Salesforce does not maintain the tool, cannot address bugs in it, and cannot guarantee it will remain available, recommending Code Builder, Salesforce CLI and the VS Code extensions instead. Workbench’s own documentation states that it is not a supported Salesforce product and advises against using it with production data. If you use it, treat it as a temporary convenience and move recurring work to a supported tool.

Which Export Method Should You Use?

Match the method to the size of the result set and whether you will need to run it again.

MethodBest forOutputHandles large result setsOfficially supported
Copy from the results gridA handful of rows you need immediatelyClipboard paste into a spreadsheetNo, limited by what the grid displaysNot an export feature; manual copy only
Data LoaderLarge one-off or scheduled extractionsCSV fileYesYes, supported Salesforce client application
SOQL Builder (VS Code)Developers already working in VS Code.csv or .json fileModerateYes, part of the Salesforce Extension Pack
Salesforce CLIRecurring, scripted or pipeline exportsCSV written to a filePartly; Salesforce notes the CLI does not currently support bulk queriesYes
WorkbenchLegacy habit only; migrate away from itCSV downloadYesNo. Salesforce does not maintain it and advises using supported tools

Common Export Problems and Solutions

Empty results. Usually a filter problem or a visibility problem. Remove the WHERE clause and re-run: if rows appear, the filter is wrong. If nothing appears, your user probably lacks read access to the object, or the records are owned by others and your sharing model restricts them.

Fewer rows than expected. A SOQL query returns only what the running user can see, so a query run by an admin and the same query run by a standard user can legitimately return different counts. The Developer Console grid also caps how many rows it displays, so check the actual file rather than the on-screen grid.

Permission errors. Data Loader and the CLI both require the API Enabled permission on the user profile or a permission set, plus field-level read access to every field in the SELECT clause. A field the user cannot see will fail the query rather than silently omit the column.

Broken characters or misaligned columns in the CSV. This is an encoding issue. Export as UTF-8, and when opening in Excel use the import flow and specify UTF-8 rather than double-clicking the file, which is what mangles accented characters. Text containing commas or line breaks needs proper quoting, which is another reason to prefer a real export over a clipboard copy.

Relationship queries look wrong. Parent fields use dot notation, such as Contact.Account.Name. Child subqueries return nested results that do not flatten neatly into a single CSV row, so exporting parent and child records separately and joining them afterwards is usually cleaner.

Export Salesforce Query Results Reliably

The Developer Console is for inspecting data, not extracting it. Run and validate your SOQL there, then pick the export path that matches the job: clipboard for a quick look, SOQL Builder if you live in VS Code, Data Loader for volume, and the CLI for anything you will run more than once.

One caveat worth stating plainly: an exported CSV is a snapshot, not a backup. It captures the fields you selected at the moment you ran the query, without relationships, metadata, attachments, or any way to restore records to the org. It is fine for analysis and for handing data to another system. If the goal is protecting your org against data loss, that calls for real backups with point-in-time recovery, rather than a folder of spreadsheets.

Frequently Asked Questions (FAQ)

Can Salesforce Developer Console export query results directly to CSV?
No. The Developer Console Query Editor has no export button and no right-click download option. You can select and copy rows from the results grid into a spreadsheet, but that is a manual copy rather than a file export. To produce an actual CSV, use Data Loader, SOQL Builder in VS Code, or the Salesforce CLI.
How do I copy Salesforce Developer Console results into Excel?
Run your query in the Query Editor, click the first cell in the results grid, then shift-click the last cell to select the range and press Ctrl+C or Cmd+C. Paste into Excel or Google Sheets and save as .csv if you need a file. Column headers may not transfer cleanly, so this suits small result sets only.
Why are some query results missing from my export?
A SOQL query returns only records the running user is permitted to see, so sharing rules and object permissions can legitimately reduce the count. Check that your user has read access to the object and every field in the query. Also remember the Developer Console grid caps how many rows it displays, so verify against the exported file rather than the screen.
What is the best alternative to Salesforce Workbench?
Salesforce recommends its own supported tools instead: Salesforce CLI, the VS Code extensions including SOQL Builder, and Code Builder. For straightforward CSV extraction, Data Loader is the most direct replacement. Salesforce has stated it does not maintain Workbench and cannot guarantee its continued availability, so moving recurring work to a supported tool is worthwhile.
Can Data Loader export the results of a SOQL query?
Yes. In Data Loader, choose Export, select your object, then either pick fields through the wizard or open the SOQL editor and paste your query directly. Data Loader writes the results to a CSV file you name. Use Export All instead of Export if you also need records currently sitting in the Recycle Bin.
How do I export large Salesforce query results?
Use Data Loader, which is built for volume and handles far more rows than the Developer Console displays. The Salesforce CLI also works for scripted exports, though Salesforce notes it does not currently support bulk queries, so very large extractions are more reliable through Data Loader. Avoid the clipboard method entirely at scale.
Can SOQL Builder save query results as CSV or JSON?
Yes. SOQL Builder ships with the Salesforce Extension Pack for VS Code, and its results panel includes Save icons that write the output to a .csv or .json file in a location you choose. Add those file paths to your .gitignore so exported data is not committed to source control or deployed to an org.
What permissions are required to export Salesforce data?
API-based tools such as Data Loader and the Salesforce CLI require the API Enabled permission on the user profile or a permission set. You also need read access to the object and field-level read access to every field in the SELECT clause, because a field the user cannot see causes the query to fail rather than silently drop the column.
Table Of Contents
Author
Stay Up-to-Date
Get flosum.com news in your inbox.

Thank you for subscribing