adspace
How to import attachments using data loader in salesforce?
Answer Posted / Sumit Kudesia
To import Attachments using Data Loader, first export the Attachment object and then create a CSV file for Attachments. Here's an example for a simple scenario:
1. Export Attachments: Go to Setup > Data > Data Export, select Attachment, choose the desired date range (Last Month/30 Days) and click on 'Export Now'. Download the `unfilteredAttachments.csv` file.
2. Create a CSV file for Attachments: Open the downloaded `unfilteredAttachments.csv` file, remove unnecessary columns, and keep only required columns like: ContentType, BodyLength, ParentId, Uid, IsPrivate, Subject, whatId, CreatedDate, LastModifiedDate, SystemModstamp.
3. Prepare Attachment Data: Add the new attachment data as follows:
```makefile
ContentType,BodyLength,ParentId,Uid,IsPrivate,Subject,whatId,CreatedDate,LastModifiedDate,SystemModstamp,Attach_Data__c
text/plain;charset=UTF-8,23,"001a0000005A000","600100000008777","false","Test Attachment","001a0000005A000",2022-01-01T00:00:00.000Z,2022-01-01T00:00:00.000Z,2022-01-01T00:00:00.000Z,"Base64Encoded Attachment Data"
```
Replace `Base64Encoded Attachment Data` with the Base64 encoded data of your attachment.
4. Import Attachments: In Data Loader, select 'Attachments' as the object and load your prepared CSV file.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers