You can use Data Loader to upload attachments to Salesforce. Before uploading attachments, note the following:
- If you intend to upload via the Bulk API, verify that Upload Bulk API Batch as Zip File on the page is enabled.
- If you are migrating attachments from a source Salesforce organization to a target Salesforce organization, begin by requesting a data export for the source organization. On the Schedule Export page, make sure to select the Include Attachments... checkbox, which causes the file Attachment.csv to be included in your export. You can use this CSV file to upload the attachments. For more information on the export service, see Export Backup Data from Salesforce.
To upload attachments:
- Confirm that the CSV file you intend to use for attachment importing contains the following required columns (each column represents a Salesforce field):
- ParentId - the Salesforce ID of the parent record.
- Name - the name of the attachment file, such as myattachment.jpg.
- Body - the absolute path to the attachment on your local drive.
Ensure that the values in the Body
column contain the full file name of the attachments as they exist on your computer. For example, if an attachment named myattachment.jpg
is located on your computer at C:\Export
must specify C:\Export\myattachment.jpg
. Your CSV file might look like this:
The CSV file can also include other optional Attachment fields, such as Description.
- Proceed with an insert or upsert operation; see Insert, Update, or Delete Data Using Data Loader. At the Select data objects step, make sure to select the Show all Salesforce objects checkbox and the Attachment object name in the list.