CSV formula safety and preserving leading zeros
Understand formula-like CSV values, safety escaping and literal XLSX text cells. Preserve identifiers and check how your spreadsheet imports a file.
CSV is text, not a typed workbook
A CSV value beginning with =, +, - or @ can be interpreted as a formula by spreadsheet software. Neatbo never executes it; the risk concerns what happens when you later open the file in another application.
Leave safety escaping enabled
Relevant exports prefix potentially active cells with an apostrophe by default. This intentionally changes the exported cell text to reduce formula interpretation. Only turn it off after reviewing the data and the receiving application.
Use XLSX when literal text matters
CSV-to-XLSX writes literal string cells, keeping values such as 00123 and =1+1 as text. The XLSX-to-CSV reader does not recalculate formulas and explains missing cached values.
Test the receiving spreadsheet, not only the export
Use fictional identifiers and harmless formula-like strings to test an import. Check the actual cell value as well as its display: a column can look correct while a leading zero, long identifier or date-like string has already been converted.
Safety escaping intentionally changes selected cell text. This is suitable for some spreadsheet handoffs but may be wrong for an API that expects exact values. Decide who will consume the file before choosing the export mode, and document that choice with the handoff.
| Example value | Concern | Check |
|---|---|---|
| 00123 | Leading zero | Import as text or use literal XLSX cells |
| =1+1 | Formula interpretation | Keep relevant safety escaping enabled |
| 2026-09 | Automatic date conversion | Inspect the stored value |
| 9007199254740993 | Identifier precision | Keep it as text end to end |
id,note
00123,=1+1
00456,plain textBefore you finish
- Do not assume surrounding double quotes neutralize a formula.
- Review the destination application’s import settings.
- Check a long ID, a leading-zero ID and a formula-like cell.
- Retain the original data when a safety transformation changes text.
References
- RFC 4180: CSV format
Reference for common delimiter and quoting conventions; spreadsheet import behavior varies.