CSV (Comma Separated Values)
CSV (Comma Separated Values) is a plain-text file format that stores tabular data: rows of records separated by line breaks, fields within each row separated by commas, and (optionally) text fields wrapped in double quotes to escape embedded commas or newlines.
Definition
CSV (Comma Separated Values) is a plain-text file format that stores tabular data: rows of records separated by line breaks, fields within each row separated by commas, and (optionally) text fields wrapped in double quotes to escape embedded commas or newlines. In the Salesforce context, CSV is the de facto exchange format for bulk data: Data Loader exports and imports use CSV, the Data Import Wizard reads CSV, Salesforce Reports export to CSV, and most third-party tools that talk to Salesforce read or write CSV files.
CSV exists in Salesforce because it is the lowest common denominator for tabular data exchange. Every spreadsheet program (Excel, Google Sheets, Numbers) can read and write it. Every programming language has a CSV parser. Salesforce APIs accept and return CSV alongside XML and JSON. The format is not standardized as rigorously as JSON (different tools handle quoting and line endings slightly differently), but it is the workhorse format for moving data in and out of Salesforce orgs at scale.
How CSV is used across Salesforce
Data Loader and CSV
Data Loader is the most common CSV consumer in Salesforce. It reads a CSV file, maps each column to a Salesforce field, and inserts, updates, upserts, or deletes records in bulk. The mapping file (.sdl) is itself a CSV-ish format. Data Loader can handle CSVs up to 5 million rows and several gigabytes; for larger files, split into chunks.
Data Import Wizard and Excel
The point-and-click Data Import Wizard accepts CSV uploads and walks an admin through field mapping in the browser. It is designed for non-technical users importing under 50,000 records into the standard CRM objects. Most admins maintain their source data in Excel, save as CSV, and upload through the wizard.
Reports export to CSV
Salesforce Reports can be exported as CSV from the Reports tab. The export contains the visible columns and any grouping, but loses formatting (currency symbols, dates) in the raw CSV. For preserving formatting, export to Excel (.xlsx); for downstream data processing, CSV is the right pick.
Bulk API and CSV
The Salesforce Bulk API accepts CSV as the data format for large-volume insert, update, upsert, and delete operations. Bulk API jobs can process millions of records, with Salesforce parallelizing the work across multiple batches. CSV is preferred over JSON for Bulk API because of size: a 100,000-row CSV is significantly smaller than the equivalent JSON.
CSV quoting and escaping rules
The biggest source of CSV bugs is quoting and escaping. A field containing a comma or a newline must be wrapped in double quotes. A field containing a double quote must escape it as two consecutive double quotes. Different tools (Excel, Data Loader, programming libraries) sometimes disagree on edge cases (UTF-8 BOM, line endings, empty trailing rows), so always verify CSV files round-trip through your specific toolchain.
UTF-8, BOM, and character encoding
Salesforce expects CSV in UTF-8 encoding. Excel on Windows sometimes saves CSV as Windows-1252 by default, which corrupts non-ASCII characters (accents, emoji, non-Latin alphabets) when Data Loader imports. The fix is to use Excel CSV UTF-8 export option, or to save the file from a tool that explicitly writes UTF-8 (like Google Sheets, LibreOffice, or a Python script).
CSV in API automation and ETL
Most Salesforce-to-external-system integrations use CSV at some layer. MuleSoft jobs read CSV from SFTP and push to Salesforce. ETL tools (Informatica, Talend, Boomi) stage data in CSV before loading. The Salesforce Bulk API 2.0 supports CSV uploads through REST. For real-time integrations, JSON wins; for batch, CSV remains dominant.
How to work with CSV files in Salesforce
CSV usage in Salesforce is mostly about getting data in or out correctly. The format itself is simple; the rules around quoting, encoding, and field mapping cause most of the problems.
- Save your source file as UTF-8 CSV
From Excel, File, Save As, CSV UTF-8. From Google Sheets, File, Download, CSV. Verify the encoding before upload.
- Match column headers to Salesforce field API names
Data Loader maps by column header; use the exact API name (Account__c, MyCustomField__c) to avoid manual mapping. Standard fields use the API name (Name, Email, Phone), not the label.
- Quote fields containing commas, newlines, or double quotes
A field like Acme, Inc must be wrapped in double quotes. A field with an embedded double quote, like 5 inches, must double the inner quote. Validate by re-opening the CSV in a text editor.
- Verify field types match
Date fields require yyyy-MM-dd format; Datetime requires yyyy-MM-ddTHH:mm:ssZ. Boolean accepts 1/0 or TRUE/FALSE. Phone fields accept any format Salesforce can parse. Test with a small batch first.
- Use external IDs for upsert
For repeatable imports (nightly sync of customer data), add an external ID column and use upsert in Data Loader. Salesforce matches existing records by the external ID and updates them; new IDs create new records.
- Validate the output of imports
After Data Loader runs, check the Success and Error CSV files it writes. The Error CSV shows which rows failed and why. Fix and re-import the errors.
- Excel often saves CSV as Windows-1252 by default. Non-ASCII characters corrupt on import. Use the CSV UTF-8 export option explicitly.
- Trailing empty rows in Excel exports can fail Data Loader jobs. Open the CSV in a text editor and remove empty trailing lines.
- BOM (Byte Order Mark) at the start of UTF-8 files breaks some Salesforce tools. Remove with a text editor or a tool like dos2unix if needed.
- Date formats vary by locale. Excel in the US writes M/d/yyyy; Salesforce expects yyyy-MM-dd. Convert before import or set the locale explicitly in Data Loader.
- Commas inside quoted fields are tolerated; newlines inside quoted fields work in modern parsers but not all of them. Test with the specific tool you are using.
Trust & references
Cross-checked against the following references.
- Data Loader GuideSalesforce Developers
- Data Import WizardSalesforce Help
Straight from the source - Salesforce's reference material on CSV (Comma Separated Values).
- Bulk API 2.0 Developer GuideSalesforce Developers
- RFC 4180: Common Format and MIME Type for CSV FilesIETF
About the Author
Dipojjal Chakrabarti is a B2C Solution Architect with 29 Salesforce certifications and over 13 years in the Salesforce ecosystem. He runs salesforcedictionary.com to help admins, developers, architects, and cert/interview candidates sharpen their fundamentals. More about Dipojjal.
Test your knowledge
Q1. What does CSV stand for?
Q2. What character encoding does Salesforce expect for CSV imports?
Q3. Why should you run a small test batch before a large CSV import?
Discussion
Loading discussion…