I have a .csv file which has a column containing base64 string equivalent of a image. Anyway we can load the csv file into Attachments object or ContentVersion object using apex dataloader? I know if we have the actual attachment file itself in a folder on your local computer you can use dataloader, but base64 csv column mapping to VersionData on ContentVersion object throws error. Any help is appreciated.
1 Answer
You can use Data Loader to bulk upload documents and links into libraries in Salesforce CRM Content. Before uploading documents or links, 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.
- When you upload a document from your local drive using Data Loader, specify the path in the VersionData and PathOnClient fields in the CSV file. VersionData identifies the location and extracts the format, and PathOnClient identifies the type of document being uploaded.
- When you upload a link using the Data Loader, specify the URL in ContentUrl. Don’t use PathOnClient or VersionData to upload links.
The minimum set of columns required for a Content import are:
TITLE = User friendly name of the file, can be anything, but usually the filename without any folder (path) information.
PATHONCLIENT = Fully qualified file name including ALL path information.
VERSIONDATA = exactly the same as PATHONCLIENT.
FIRSTPUBLISHLOCATIONID = Salesforce ID of the Library where the document should be loaded. If you don’t put this in the file, then your files will be uploaded to your personal library which must be wrong.
-
Thanks Ayub, may be my question was not very clear. I know we upload attachments referencing the file path in one of the columns in csv. What I am looking for here is one of the column in the CSV is a base64 encoded string of an image. can we insert that into versiondata of contentversion object and it shows up as image in salesforce. Below is the sample csv file I want to load 'code' Title,PathOnCLient,VersionData TestImage1,TestImage1.jpg,<base64 String> TestImage2,TestImage2.doc,<base64 String>– sfdcdevCommented Apr 30, 2018 at 23:20