Newer Version Available

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

Sample CSV Files

These examples demonstrate different ways to use CSV data with Bulk API 2.0.

Simple CSV

This example contains three Account records and specifies the Name, Description, and NumberOfEmployees fields for each record.

A job that uses this CSV data might be defined with the following job properties.

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.

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

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.

A job that uses this CSV data and specifies that semicolon is used as the column delimiter would use the following job properties.

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.

A job that uses this CSV data might be defined with the following job properties.

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.

A job that uses this CSV data might be an upsert job defined with the following properties.

You can also associate records using external IDs. For more information, see Upserting Records and Associating with an External ID.