Q: How do I bulk-load a bunch of Attachments into Salesforce?
A: I’ve used the procedure below a few times.
- Create an attachments.csv file (the name of the file is unimportant) with the following column headers:
- ParentId – ID of the record to which the attachment should be associated (Make sure you input the record ID here)
- Name – Name of the attachment
- ContentType – Format of the extension (e.g. .xls, .pdf, etc)
- OwnerID – ID for the owner of the attachment (Make sure you input your User ID here – you can locate it following the path Setup->Manage Users->Users->Click on your name — your UserID is visible as part of the url in the address bar)
- Body – File path to the Attachment on the local machine (C:\documents and settings\schun\desktop\attachments\file.xls)
- Log in to the Data Loader.
- Select the “Insert” command.
- In the ‘Select Salesforce Object’ step, select the ‘Show all Salesforce Objects’ checkbox and then select “Attachments”.
- Choose the attachments.csv file.
- In the mapping step, map the following fields:
- Parent ID
- Name
- Content Type
- Owner ID
- Body – Make sure to map the Body column which you created previously with the file extension. This is how you designate the file and location of the attachments to be inserted.
- Click “OK” to proceed with the insert. It may take a few minutes but the attachments should be successfully uploaded to your salesforce org.
- I strongly recommend setting your batch size to 1 before starting
- Gotta love that the original instructions talk about “Sforce objects”. . . how 2010
- Thanks to the people at Google for keeping this Google Group post active, long after the original Success link went dead
- I think Salesforce has overhauled the address-formatting of Success/Community/Trailhead posts at least twice.
- Also surprising that archive.org didn’t have a snapshot of it, either
- I keep meaning to rewrite this post thoroughly and cover Content as well as Documents, but, wow, it’s been 16 years and I still haven’t gotten to it 🙄