Salesforce Bulk Data Export: Complete Documentation and Step-by-Step Guide

Whether you are migrating away from Salesforce, building a compliance archive, reducing storage costs, or taking a proper backup, you eventually need to export your data in bulk. The challenge is that "data" in Salesforce means several different things — structured records, binary file attachments, configuration metadata — and each requires a different tool and approach. This documentation covers every method available, when to use each, and how to combine them into a complete bulk export workflow.

Understanding Salesforce's Data Architecture

To export data from Salesforce correctly, you need to understand that Salesforce stores information in three fundamentally different categories:

  • Structured records in sObjects — Accounts, Contacts, Opportunities, Cases, custom objects, and their field values. These are tabular rows exportable as CSV.
  • Files and attachments in ContentDocument — binary files (PDFs, images, Word documents) attached to records. These live in ContentDocument, ContentVersion, Attachment, Document, and ContentNote objects. The binary content cannot be exported as CSV — it requires API calls to fetch the actual file bytes.
  • Metadata and configuration in XML — Apex classes, Flows, custom fields, page layouts, validation rules, permission sets. This is exported via the Metadata API, not the data API, and produces XML files.

A complete bulk export strategy requires a separate approach for each category. Failing to account for all three is the most common cause of incomplete exports and failed migrations.

Method 1 — Salesforce Data Export Wizard

Best for: Salesforce admins who need a periodic full-org backup of structured records without writing code.

How to Use It

  1. Go to Setup → Data → Data Export.
  2. Click Export Now or Schedule Export to automate recurring exports.
  3. Select whether to include images, documents, and attachments (note: this includes a URL reference in the CSV, not the actual binary files).
  4. Choose which objects to include. For a full backup, select all.
  5. Submit the request. Salesforce sends an email with a download link when the zip is ready — typically within a few hours for large orgs.

What You Get

A ZIP archive containing one CSV file per Salesforce object. All standard and custom fields are included. Related records are referenced by ID rather than name.

Important limitation: The Data Export Wizard does not download binary file attachments. Even when you select "include attachments," the export contains only a URL pointing to the file — not the file itself. To download the actual PDFs, images, and documents, you need Method 4 below.

Method 2 — Data Loader Bulk Export

Best for: Technical admins who need to export large record counts with custom filtering, or who need more control than the Data Export Wizard provides.

How to Use It

  1. Install Data Loader. Download it from Setup → Data Import Wizard → Launch Data Loader. Requires Java 11 or later.
  2. Open Data Loader and select Export. Log in with your Salesforce credentials or use OAuth.
  3. Choose the object to export. Select from all available sObjects, including custom objects.
  4. Write your SOQL query. For a full object export: SELECT Id, Name, CreatedDate FROM Account. Add a WHERE clause to filter by date, owner, record type, or any other field.
  5. Choose your output CSV file path and click Finish.
In Data Loader's Settings, increase the batch size to 2,000 (maximum for Bulk API v1) to maximize throughput for large exports. For Bulk API v2, batch size is managed automatically.

Method 3 — Bulk API for Developers

Best for: Developers building automated pipelines, ETL processes, or integrations that need to export millions of records programmatically.

The Salesforce Bulk API v2 is a REST API designed specifically for processing large volumes of records. It runs asynchronously — you submit a job, Salesforce processes it, and you poll for completion before downloading the results.

# Bulk API v2 Export — Pseudocode
# 1. Create a query job
POST /services/data/v59.0/jobs/query
{ "operation": "query", "query": "SELECT Id, Name FROM Opportunity WHERE CreatedDate >= 2025-01-01T00:00:00Z" }
# Returns: { "id": "750xx000000blbXXXX", "state": "UploadComplete" }

# 2. Poll for completion
GET /services/data/v59.0/jobs/query/750xx000000blbXXXX
# Wait until "state" == "JobComplete"

# 3. Download results as CSV
GET /services/data/v59.0/jobs/query/750xx000000blbXXXX/results
# Returns: CSV content stream
Like all other record-level methods, the Bulk API does not export file binaries. Querying ContentVersion via Bulk API gives you metadata and a URL — not the actual file content. Fetching file content requires the REST API's /sobjects/ContentVersion/{Id}/VersionData endpoint, one request per file.

Method 4 — SFDC File Exporter for Files and Attachments

Best for: Anyone who needs to export the actual binary files — PDFs, images, Word documents, spreadsheets, enhanced notes — not just the metadata rows about those files.

This is the only method on this list that exports actual file content. Methods 1–3 can tell you a file exists and give you its metadata, but they cannot deliver the file itself without significant additional development work.

The ContentDocument/VersionData Challenge

To download a Salesforce file programmatically, you need to:

  1. Query ContentVersion to get the Id, Title, FileExtension, and ContentDocumentId for each file.
  2. Make an authenticated HTTP GET request to /services/data/vX.X/sobjects/ContentVersion/{Id}/VersionData.
  3. Receive a binary response and write it to disk with the correct filename.
  4. Repeat for every file, managing rate limits and token refresh throughout.

For classic Attachments, the process uses /sobjects/Attachment/{Id}/Body. For legacy Documents, it uses /sobjects/Document/{Id}/Body. Each file type requires different API endpoints and different query logic.

SFDC File Exporter handles all of this automatically. Connect your org, select your file types and filters, choose an output folder, and the tool downloads every matching file — named correctly, organized by record, with a metadata CSV alongside. No coding required.

Read the full step-by-step guide: Salesforce File Exporter: Mass Export Files and Attachments in Minutes.

Building a Complete Bulk Export Workflow

Data Type Best Method Output Format
Standard object records (Account, Contact, etc.)Data Export Wizard or Data LoaderCSV
Custom object recordsData Loader with SOQL queryCSV
Files / ContentDocumentSFDC File ExporterOriginal file format (PDF, DOCX, etc.)
Classic AttachmentsSFDC File ExporterOriginal file format
Enhanced Notes (ContentNote)SFDC File ExporterHTML / text
Legacy DocumentsSFDC File ExporterOriginal file format
Metadata / configuration (Flows, Apex, fields)Salesforce CLI (sf project retrieve start)XML (Metadata API format)
Very large record sets (>1M rows)Bulk API v2 (custom script)CSV

Common Errors and How to Fix Them

Governor Limit Hit (REQUEST_LIMIT_EXCEEDED)

You've consumed your org's daily API call allocation. Check your current usage at Setup → System Overview → API Usage (Last 24 Hours). If near the limit, pause your export and resume the next day, or use date-range filters to reduce API calls per session. Run large exports during off-hours when other integrations are idle.

Export Timeout (Data Export Wizard)

For very large orgs, the Data Export Wizard can time out before completing. The fix is to use Data Loader instead, which uses Bulk API and processes data asynchronously — it won't time out regardless of record count.

Encoding Issues with Special Characters

Salesforce CSV files use UTF-8 encoding. If you open them in Excel on Windows and see garbled characters, the issue is Excel defaulting to system locale encoding rather than UTF-8. Fix: open Excel → Data → From Text/CSV → set encoding to 65001 (UTF-8) in the import wizard. Google Sheets handles UTF-8 correctly by default.

File Too Large Error (ContentVersion download)

Salesforce enforces a maximum file size of 2 GB per ContentVersion. Very large files may fail to download via the standard REST API endpoint. If SFDC File Exporter encounters an oversized file, it logs the error with the file's ID and name so you can handle it separately. For files over 2 GB, download them directly from the Salesforce UI.

Export Frequency Recommendations

  • Daily: Files and attachments added or modified in the last 24 hours (SFDC File Exporter with "last modified date" filter); high-velocity objects like Cases, Leads, Orders.
  • Weekly: Full structured record export for all standard objects; Enhanced Notes export.
  • Monthly: Full org-wide file export without date filtering; metadata snapshot committed to version control.
  • Before any deployment: Full backup of all categories — records, files, metadata — regardless of the regular schedule. Run it explicitly, not just the scheduled job.

Compliance Considerations

  • Data retention periods. Many industries require records and documents to be retained for 5–10 years. Your export archive must be preserved for the full retention period, even after the Salesforce subscription ends.
  • GDPR and data subject rights. If your org contains personal data of EU residents, you need the ability to locate and delete a specific individual's data across your archive. SFDC File Exporter's metadata CSV makes individual file records searchable by name, record ID, and owner.
  • Legal holds. When litigation begins, export the files in scope immediately and document the chain of custody. SFDC File Exporter's metadata CSV — recording file IDs, record IDs, timestamps, and owner names — supports this documentation requirement.
  • Audit trails. Log who ran each export, when, which data was included, and where it was stored. Keep export run logs alongside the exported data.

Getting Help from RASPSYS LLP

If your export requirements are complex — a large org with millions of files, a migration with a hard deadline, a compliance requirement with strict documentation standards, or a multi-org consolidation — RASPSYS LLP can help. We provide professional Salesforce data export, migration planning, and implementation services for organizations of all sizes.

Learn about RASPSYS Salesforce Services or contact us for a free consultation.

Start Your Complete Salesforce Data Export

SFDC File Exporter handles the hardest part — the actual file binaries. Combine it with Data Loader and the Salesforce CLI for a complete export of every data type in your org.