Newer Version Available
Sample CSV Files
Simple CSV
This example contains three Account records and specifies the Name, Description, and NumberOfEmployees fields for each record.
1Name,Description,NumberOfEmployees
2TestAccount1,Description of TestAccount1,30
3TestAccount2,Another description,40
4TestAccount3,Yet another description,50A job that uses this CSV data might be defined with the following job properties.
1{
2 "object" : "Account",
3 "contentType" : "CSV",
4 "operation" : "insert"
5}CSV with Alternate Line Ending
This example contains two Contact records and specifies three fields for each record. The data was created on a Windows platform, and each line ends with a carriage return and line feed. The carriage return is displayed as “^M” in this example.
1FirstName,LastName,Description^M
2Tom,Jones,Branding guru^M
3Ian,Dury,Fuzzy logic expert^MA job that uses this CSV data and specifies that carriage return + line feed is used as the line ending sequence would use the following job properties.
1{
2 "object" : "Contact",
3 "contentType" : "CSV",
4 "operation" : "insert",
5 "lineEnding" : "CRLF"
6}CSV with Semicolon Delimiter and Escaped Fields
This example contains two Contact records and specifies five fields for each record. The field delimiter is a semicolon instead of a comma. The Description fields contain characters that must be escaped using double quotes, including a line break in the second record.
1FirstName;LastName;Title;Birthdate;Description
2Tom;Jones;Senior Director;1940-06-07Z;"Self-described as ""the top"" branding guru"
3Ian;Dury;Chief Imagineer;1965-12-11Z;"Expert in fuzzy logic design; Knowledgeable in AI
4Influential in technology purchases."A job that uses this CSV data and specifies that semicolon is used as the column delimiter would use the following job properties.
1{
2 "object" : "Contact",
3 "contentType" : "CSV",
4 "operation" : "insert",
5 "columnDelimiter" : "SEMICOLON"
6}CSV with Relationship Field
This example contains two Contact records and specifies FirstName, LastName, and Owner.Email fields for each record. This example assumes a unique User record exists that has an Email value of “mfellow@salesforce.com”, and creates a relationship with this record and the Contact records. If the User record doesn’t exist, or if there are multiple User records with an Email value of “mfellow@salesforce.com”, the relationship can’t be created and the job fails.
1FirstName,LastName,Owner.Email
2Joe,User,mfellow@salesforce.com
3Jane,User,mfellow@salesforce.comA job that uses this CSV data might be defined with the following job properties.
1{
2 "object" : "Contact",
3 "contentType" : "CSV",
4 "operation" : "insert"
5}CSV for Upsert Using External IDs
This example contains three Contact records and specifies FirstName, LastName, Phone, and ExternalId__c for each record. This example assumes the custom ExternalId__c external ID field has been added to Contact.
1FirstName,LastName,Phone,ExternalId__c
2Mark,Brown,4155558787,"1001"
3Dave,Stillman,4155552212,"1002"
4Joe,Smith,2125556363,"5001"A job that uses this CSV data might be an upsert job defined with the following properties.
1{
2 "object" : "Contact",
3 "externalIdFieldName" : "ExternalId__c",
4 "contentType" : "CSV",
5 "operation" : "upsert"
6}You can also associate records using external IDs. For more information, see Upserting Records and Associating with an External ID.