Data Loader is the first tool most admins reach for when files have to move between Salesforce orgs. It does part of the job well: it uploads files and attachments from your computer and creates the links that attach them to records. What it can't do is get the files out of the source org, and that is where most of the work in a file migration sits. This guide covers what Data Loader does with files, the full manual route, the limits you'll hit, and how to tell whether it's enough for your migration.
What Data Loader can do with files
Data Loader writes three kinds of file record, all from a CSV that points at files on your own disk:
- Salesforce Files. Insert
ContentVersionrows withVersionDataandPathOnClientboth set to the file's full local path. Data Loader converts each file to base64 as it uploads, which adds about 30% to its size.OwnerIdis optional and defaults to the user running the load.FirstPublishLocationIdattaches the new file to a record as it's created; the object reference accepts any record a file can be linked to. - Legacy attachments. Insert
Attachmentrows withParentIdandBodyset to the absolute path of the file. - Extra links. Insert
ContentDocumentLinkrows to attach an existing file to more records. Each row needsContentDocumentId,LinkedEntityIdand aShareTypeof V (viewer), C (collaborator) or I (inferred from the record).
With the Set Audit Fields upon Record Creation permission, you can also set CreatedDate and CreatedById on both ContentVersion and Attachment as they're inserted. Salesforce's System Fields page lists which objects accept audit fields; ContentDocumentLink isn't one of them.
What it can't do
The gaps are all on the way out of the source org and in tying the pieces together:
- It can't export the files. The Data Loader Guide says it plainly: "Data Loader currently does not support exporting attachments." Exporting
ContentVersiongives you a CSV of file records, not the files themselves, and without the Query All Files permission it only includes files owned by or shared directly with the user running the export. - It doesn't translate IDs. Every
ParentIdandLinkedEntityIdin the source refers to a source record. Data Loader loads whatever ID is in the column, so mapping each one to the matching record in the target org is your job. - It doesn't connect the steps. Each load writes its own success and error CSVs. Working out which files made it through the export, the upload and the linking, and which need another attempt, happens in your spreadsheets.
The manual route, step by step
Salesforce's own instructions for moving attachments between orgs begin with a data export of the source org. The full route looks like this:
ContentVersion and Attachment rows with Data Loader.ContentDocumentLink rows for files on several records.1. Export the source org
In Setup, schedule a Data Export and tick both Include images, documents, and attachments and Include Salesforce Files and Salesforce CRM Content document versions. Plan around its rules:
- You can run it once every 7 days with weekly export (Enterprise, Performance and Unlimited editions) or once every 29 days with monthly export. Professional and Developer editions get the 29-day schedule only.
- Large exports are split into zip files of about 512 MB each. You download them one at a time, with a 60-second wait between downloads.
- The zip files are deleted 48 hours after the notification email, not counting weekends. A large org can run out of time before every file is down.
- Data Export doesn't run in sandboxes, so you can't rehearse this step against a sandbox copy.
2. Unpack and rename the files
Exported attachments are named by their 18-character record ID, not their file name, and documents usually lose their extensions. Exported Salesforce Files are named by their ContentVersion ID and arrive in a format that has to be converted before it opens. Salesforce's workaround is to build a rename script from the Id and PathOnClient columns of ContentVersion.csv (and from Attachment.csv for attachments), then run it in each zip's folder.
3. Map the IDs
For each file, find the target-org record that matches its source parent. This only works if the parents are already in the target org with something to match on, usually an external ID field holding the source record's ID. Build the upload CSV from that mapping:
Title,PathOnClient,VersionData,FirstPublishLocationId,OwnerId,CreatedDate
Signed MSA,C:\export\files\MSA.pdf,C:\export\files\MSA.pdf,001TARGETACCOUNTID,005TARGETUSERID,2024-03-14T09:12:00Z
Owners need mapping too: the user IDs in the export belong to the source org.
4. Upload the files
Salesforce enforces a limit of about 50 MB per batch when Data Loader imports attachments or files, so set the batch size to 1 for file loads; Salesforce gives the same advice for attachment imports. Each batch is one API call, so a 20,000-file load is 20,000 calls against your org's daily allocation. If you switch on the original Bulk API's zip upload instead, each zip is capped at 10 MB.
5. Link files that belong to more than one record
FirstPublishLocationId attaches a file to one record. Files shared with several records need a second load of ContentDocumentLink rows, with the new ContentDocumentId from step 4's success file and the mapped LinkedEntityId. Exporting the source links has its own catch: Salesforce rejects a ContentDocumentLink query that doesn't filter on Id, ContentDocumentId or LinkedEntityId, unless the user has Query All Files.
6. Reconcile
Compare file counts per object between the two orgs, work through the error CSVs from steps 4 and 5, and repeat the loads for what failed, taking care not to upload files that already made it.
Limits you'll hit
| Limit | Value |
|---|---|
| Largest file through the SOAP API (Data Loader's default) | 38 MB |
| Largest zip through the original Bulk API | 10 MB (20 MB unzipped, 1,000 files) |
| Largest file in Lightning (Salesforce Files) | 10 GB |
| Largest file through the REST API (not available in Data Loader) | 2 GB |
| Data Export frequency | Every 7 days (weekly) or 29 days (monthly) |
| Data Export download window | 48 hours, excluding weekends |
| New file versions per 24 hours | 200,000 |
| Records a file can be shared with | 2,000 |
The first row is the one that usually decides things. Salesforce Files accept uploads of up to 10 GB, so most orgs have at least some files that Data Loader can't carry at all. Those need the REST API, which takes up to 2 GB per file as a multipart upload.
When Data Loader is enough
Data Loader is a reasonable choice when all of these are true:
- You're moving hundreds of files, not tens of thousands.
- Every file is under 38 MB.
- Most files belong to a single record, so the second linking load is small.
- It's a one-off move you can finish inside one export's 48-hour window.
- The parent records are already in the target org with an external ID to match on.
Version history is the other thing to decide up front. Each row Data Loader inserts without a ContentDocumentId becomes a new file, so the default result is one version per file.
Data Loader compared with a purpose-built tool
| Data Loader route | Purpose-built migration tool | |
|---|---|---|
| Getting files out | Data Export zips, at most weekly, renamed by hand | Read from the source org through the API, on demand |
| Large files | 38 MB per file (SOAP), 10 MB per Bulk API zip | Up to 2 GB per file through REST multipart uploads |
| Parent records | You map source IDs to target IDs in a spreadsheet | Mapped by the tool, with validation before anything moves |
| Files on several records | A separate ContentDocumentLink load | Links recreated with each file |
| Failures and re-runs | Error CSVs per load; you work out what to retry | Per-file status; re-runs skip files already done |
| Scale | One API call per file at batch size 1, paced by hand | Parallel workers kept within the org's API limits |
Moving more files than Data Loader can comfortably handle?
Salesforce File Migration reads files directly from the source org, uploads them with their parent links, owners and sharing, and writes a per-file report you can re-run from.
Sources
- Upload Files and Links with Data Loader · Data Loader Guide
- Upload Attachments · Data Loader Guide
- Export Data from Salesforce · Data Loader Guide
- Understanding Export Content Documents or Files and Permissions Needed Using Salesforce Data Loader · Salesforce Help
- Export Backup Data from Salesforce · Salesforce Help
- Rename exported attachments or document files · Salesforce Help
- Rename and convert exported Chatter files, content, and feed attachments · Salesforce Help
- Salesforce Error 'Maximum size of request reached' When Importing Attachment or Content · Salesforce Help
- Import Notes and Attachments using Data Loader · Salesforce Help
- File Size and Sharing Limits · Salesforce Help
- System Fields · Salesforce Object Reference
- ContentVersion · Salesforce Object Reference
- ContentDocumentLink · Salesforce Object Reference
- Bulk API and Bulk API 2.0 Limits and Allocations · Salesforce Developers