August 16, 2026
CSV to Excel: Keeping Leading Zeros and Long IDs From Getting Mangled
Excel automatically converts numeric-looking CSV values into real numbers on import, which silently strips leading zeros ("00501" becomes 501) and can convert long ID numbers into scientific notation once they exceed about 15 digits of precision. Neither is a bug in the conversion — it's Excel's default type inference doing exactly what it's designed to do, just not what you want for values that are numeric-looking text, not actual numbers.

Why this happens
CSV has no type system at all — every value is plain text, with no way to mark "this is a numeric-looking string, not a real number." When Excel (or a converter mimicking its behavior) imports the file, it has to guess, and a value made entirely of digits gets treated as a number by default unless told otherwise.
Which values are actually at risk
- ZIP codes with leading zeros (00501, 02134)
- Phone numbers, especially with a leading + or leading 0
- Long ID numbers, credit card numbers, or account numbers beyond about 15 digits
- Any code where the exact string of digits matters more than its numeric value
The fix
The reliable fix is formatting the destination column as Text before the data lands in it, rather than trying to fix it after Excel has already reinterpreted the values — once a leading zero is dropped or a long number is rounded into scientific notation, the original precision is gone and can't be recovered from the spreadsheet alone. If you're building the conversion yourself, wrapping a value in an explicit text-formatted cell (rather than a bare number) preserves it exactly as it appeared in the source CSV.
Want to try this yourself?
Open CSV to Excel →