Newer Version Available

This content describes an older version of this product. View Latest

Uploading Attachments

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 Settings | Settings 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:
  1. 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, Body must specify C:\Export\myattachment.jpg. Your CSV file might look like this:
      1ParentId,Name,Body
      250030000000VDowAAG,attachment1.jpg,C:\Export\attachment1.gif
      3701300000000iNHAAY,attachment2.doc,C:\Export\files\attachment2.doc

    The CSV file can also include other optional Attachment fields, such as Description.

  2. 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.