You click Export on a Salesforce report, open the file, and the row count doesn't match the report. Or the subtotals are gone, or a notes column stops partway through a sentence. Almost every one of these comes from picking the wrong export mode, or the wrong tool for the data. This guide matches each job to a method and shows how to catch a short file before anyone else does.
Choose the method before you click Export
Pick the row in this table that matches your export.
| Situation | Method | Output | Watch for |
|---|---|---|---|
| Someone wants the report as it looks on screen | Export, Formatted Report | .xlsx | Row caps; matrix commonly cited at 2,000 |
| You need raw rows to pivot, sort or VLOOKUP | Export, Details Only | .xlsx or .csv | No groupings or subtotals |
| A list view | Rebuild it as a report, or Data Loader with matching SOQL | .xlsx or .csv | List views have no Export action |
| Every field, including long text | Data Loader or sf data query |
.csv | Field-level security |
| Recurring delivery to people | Report subscription | Whose access the subscription runs under | |
| Recurring delivery to a script or another system | Reports REST API, or SOQL | JSON or .xlsx | 2,000 rows per report run |
| A backup of the whole org | Setup, Data Export | Zip of CSVs | Scheduled, so no good for ad hoc pulls |
My default for anything headed into a spreadsheet for analysis is Details Only as .csv. It has no 2,000-row restriction and opens in any tool. The cost is that you lose the groupings and subtotals Salesforce built for you, and whoever opens the file has to rebuild them. I only pick Formatted Report when the file is the deliverable: a manager wants the familiar layout and won't touch the numbers.
Formatted Report vs Details Only
The Export dialog in Lightning offers two export views, and they produce different files.
| Formatted Report | Details Only | |
|---|---|---|
| File format | .xlsx only | .xlsx or Comma Delimited .csv |
| Report header, groupings, filter settings | Included | Left out |
| Subtotals | Included | Left out |
| Row limit | Commonly cited as 100,000 rows and 100 columns for tabular and summary reports, 2,000 rows for matrix reports | No 2,000-row restriction |
| Best for | A file people read as it is | Analysis, pivots, loading into another system |
If you need a CSV, you need Details Only. Formatted Report only comes out as .xlsx.
The Formatted row figures in that table are the ones usually quoted from Salesforce Help's 'Export a Report' article. That page would not load when I checked, so they are not yet confirmed for the current release; look them up in your org's Help before you depend on them. Whatever the exact figure, if a Formatted export of a matrix report has exactly 2,000 data rows, assume it hit the commonly cited matrix cap. Re-export as Details Only and rebuild the matrix as a pivot table in Excel. If the commonly cited matrix cap applies, a commission sheet built from a Formatted matrix export stops at 2,000 rows with no warning, and the rows that go missing are whatever sorts last, often the latest close dates.
To run a Details Only export:
- Open the report.
- Click the dropdown arrow next to Edit and choose Export. If Export isn't in the menu, your profile or permission set is missing the Export Reports permission. Ask an admin to grant it.
- Select Details Only.
- Choose Excel (.xlsx) or Comma Delimited (.csv). For .csv, also pick an encoding.
- Click Export.
If the data has accented names or non-Latin characters, pick UTF-8. Double-clicking a UTF-8 CSV can garble those characters in Excel, so open it through Data > From Text/CSV and set the encoding there.
Exporting list views, opportunities and object data
List views
Lightning list views have no Export action, which leaves two routes. One is to build a report on the matching report type, copy the list view filters into it, set the Show Me scope to match (My Opportunities, All Opportunities and so on), and export it as Details Only. If you aren't sure which report type exposes the fields you need, the report types guide covers how they join objects. The other is a Data Loader export whose SOQL WHERE clause mirrors the list view filters. I take that route when the list view includes long text or when the same export will run again.
Opportunities
For pipeline grouped by stage, owner or close month, report on the Opportunities report type and export. When someone wants every field on every open deal, Description notes included, go to SOQL. This query pulls open pipeline closing this quarter and next:
SELECT Id, Name, StageName, Amount, Probability, CloseDate,
Owner.Name, Account.Name, Description
FROM Opportunity
WHERE IsClosed = false
AND (CloseDate = THIS_QUARTER OR CloseDate = NEXT_QUARTER)
ORDER BY CloseDate ASC
Object data with Data Loader or the CLI
In Data Loader, choose Export, log in, pick the object, then select fields or paste a SOQL query like the one above, and write the result to CSV. Data Loader also handles loading data back in; the Data Loader vs Import Wizard comparison explains when each one fits.
If you already use the Salesforce CLI, the same query goes straight to a file:
sf data query \
--query "SELECT Id, Name, StageName, Amount, CloseDate, Account.Name, Description FROM Opportunity WHERE IsClosed = false" \
--result-format csv \
--output-file open-pipeline.csv \
--target-org prod-admin
SOQL has no 2,000-row cap on total results. The REST query API returns up to 2,000 records per response and hands back a nextRecordsUrl for the next page. Once an export runs to tens of thousands of rows, I move it to Data Loader with the Bulk API switched on.
For a copy of everything, Setup > Data Export runs on a schedule and produces zip files of CSVs for all objects. It is a backup route and far too blunt for a single report.
Subscriptions and the Reports REST API
Report subscriptions are for recurring delivery to people. To set one up:
- Open the report and click Subscribe.
- Set the frequency and time.
- Add recipients.
- If you want the file in the email, turn on the attachment option and choose the export format. Check which formats your org offers.
- Save.
The subscription runs under one user's access, and that decides which rows land in each inbox. Check whose access it is before you add recipients, or two people comparing copies will ask why their numbers differ. I keep subscriptions for human readers and use the API for anything a script or another system consumes.
The Reports REST API (the Analytics API) runs a report and returns JSON by default. POST to the report resource with the spreadsheet MIME type in the Accept header and Content-Type kept as application/json, and the run comes back as an Excel file in the same request. To download a report you already ran, send a GET instead.
API_VERSION="v62.0"
REPORT_ID="00O5g00000RnwLsEAJ"
curl -sS -X POST "$INSTANCE_URL/services/data/$API_VERSION/analytics/reports/$REPORT_ID?includeDetails=true" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" \
-o weekly-renewals.xlsx
The Analytics API returns at most 2,000 rows per report run. That cap dates back to Winter '14, and no org setting raises it. The API has no paging, so a 200,000-row report would have to be split into at least 100 runs with narrower filters, and if those run asynchronously they count against the org's 1,200 per rolling 60 minutes, a limit shared by every user. SOQL against the same object has no such total limit, so for anything bigger, query the object directly. If you pull the rows in Apex, the governor limit is 50,000 SOQL rows per transaction. To read a report's definition before you run it, see retrieving report metadata with the REST API.
Why your export is missing rows or truncating text
A file with exactly 2,000 rows has most likely hit a cap: either the commonly cited cap on Formatted exports of matrix reports, or the 2,000 rows per Reports REST API run. Also check what you are comparing against: if the report page doesn't display every row, use the record count in the report header.
A file that is short by an odd number usually comes from the report itself. Open the filters and look for a Row Limit left over from testing, a Show Me scope set to My records, or a relative date range that has moved since the report was built. Then check visibility. An export contains only what the running user can see, and fields hidden by field-level security drop out as columns. If a colleague gets more rows from the same report, have an admin compare object and field access for the two users.
Long text that stops at 255 characters was cut by the export: Long Text Area and Rich Text Area fields can be truncated to 255 characters in some report exports, including Details Only .xlsx. Export those fields with Data Loader or sf data query, which return the full value.
Before sending any file, compare the report's record count with the file's row count. For Formatted exports, subtract the header and grouping rows first.
What to watch for
- Excel strips leading zeros from CSV columns and can mangle long numbers. Import postcodes, account numbers and IDs as text.
- 15-character Salesforce IDs are case-sensitive, so they can collide in a case-insensitive VLOOKUP. Get the 18-character ID when you plan to match on it: add a CASESAFEID(Id) formula field to the report, or export through Data Loader, which returns 18-character IDs.
- Formatted files put header and filter rows above the data, which breaks pivot tables. Use Details Only for anything you will pivot.
- For a CSV without the header row, pipe the
sf data queryCSV output throughtail -n +2. - Dates and currencies follow the exporting user's locale, so files from users in different regions may not combine cleanly.
- Formatted export limits can change between releases. Check the 'Export a Report' Help article for your release before you promise anyone a 50,000-row file.
Leave a Comment