1. The Infamous Leading-Zero Problem: Why Excel Corrupts Your Data
One of the most persistent complaints among accountants, logistics coordinators, and software engineers is that opening a CSV file in Microsoft Excel strips leading zeros from identifiers.
Input CSV: 00501,000123456789
Excel converts cells to standard numbers: 501 and 123456789. Holtsville, NY ZIP code 00501 becomes an invalid 3-digit number.
Output XLSX: 00501,000123456789
Cells are explicitly encoded as text in the OpenXML <sharedStrings> table. All digits, leading zeros, and telephone plus signs remain 100% intact.
When converting CSV to Excel, safe converters must never assume numbers should be coerced into floating-point values unless explicitly opted in by the user.
2. Delimiter Differences: Comma, Semicolon, and Tab
Despite the name “Comma Separated Values”, global spreadsheets rely on multiple delimiters based on local language formatting:
| Delimiter | Character | Common Geography & Context | Decimal Point Clashes |
|---|---|---|---|
| Standard Comma | , | United States, UK, Canada, Australia | None (Period . used for decimals) |
| Semicolon | ; | Germany, France, Spain, Brazil | Required because comma , is the currency decimal mark |
| Tab (TSV) | \t | Database exports, bioinformatics, logging | High immunity to field punctuation collision |
| Pipe | | | Mainframe systems, healthcare EDI files | Rare in natural text; very low collision rate |
3. RFC 4180 Quoting and Multiline Rules
The Internet Engineering Task Force (IETF) codified CSV behavior in RFC 4180. The core principles include:
- Embedded Commas: If a field contains a comma, semicolon, or delimiter character, the entire field must be enclosed in double quotes:
"New York, NY". - Escaped Quotes: If a quoted field contains double quotes, they must be escaped by prefixing another double quote:
"He said ""Hello"" to them". - Multiline Values: Cells containing hard line breaks (
\r\nor\n) must be wrapped in double quotes. Naive line-by-line parsers (split('\n')) inevitably break on multiline cells. - UTF-8 Byte Order Mark (BOM): Prepending the 3-byte sequence
\uFEFFsignals to Windows Excel that the file contains UTF-8 Unicode characters rather than legacy Windows-1252.
4. Spreadsheet Formula Injection (OWASP CSV Injection)
Spreadsheet programs automatically evaluate cells that begin with formula trigger characters:
=, +, -, @, \t, \rIf an untrusted user signs up with the first name =cmd|'/C calc'!A0 and an administrator exports the customer list to CSV, opening that file in Excel can execute arbitrary local system commands via Dynamic Data Exchange (DDE).
To defend against CSV injection, our tools offer an explicit sanitization option that prepends an apostrophe (') to suspicious cells. This forces the spreadsheet engine to display the formula as harmless literal text.
5. Free In-Browser Conversion Utilities
Apply these standards immediately using our 100% private, client-side spreadsheet tools, or read our step-by-step tutorials on keeping leading zeros in CSV files and opening and converting JSON files to Excel:
CSV to Excel Converter
Convert CSV to real OpenXML XLSX while strictly preserving leading zeros and long identifiers.
Excel to CSV Converter
Select worksheets, customize delimiters, include UTF-8 BOM, and escape formulas safely.
Excel to JSON Converter
Convert .xlsx workbooks (not legacy .xls) by selecting a worksheet and exporting flat JSON arrays of objects or arrays without nested JSON reconstruction.
CSV Viewer & Cleaner
Inspect tabular data, filter rows with instant search, trim whitespace, and purge duplicate rows.