Fix Excel Ruining CSV Leading Zeros & Scientific Notation

You opened a CSV of zip codes and Boston's 02116 became 2116. Or a column of 16-digit credit-card-style IDs turned into 1.23457E+15. Or a barcode like 0078000082203 dropped its leading zero and rounded its last digits into oblivion. This is the single most common data-loss disaster in spreadsheets, and the worst part is how quietly it happens. Here is exactly why Excel does it, the one rule that prevents most of the pain, and how to recover data that has not yet been re-saved.

Why Excel mangles your CSV

A CSV file is plain text. There are no data types in the file itself: 02116 is just five characters, and a long ID is just a string of digits. The format is essentially a list of fields separated by commas, as described in RFC 4180. Nothing in the file says "this column is text" or "this column is a number."

When you double-click a CSV, Excel guesses. It sees a cell that looks numeric and decides to treat it as a number. Two destructive things follow automatically:

  • Leading zeros vanish. Numerically, 02116 equals 2116, so Excel strips the zero. Zip codes in the US Northeast (which all start with 0) are the classic casualty.
  • Long digit strings flip to scientific notation. Excel stores numbers as IEEE 754 double-precision floats and shows at most 15 significant digits. A 16-digit order ID or barcode gets displayed as 1.23457E+15 and, critically, the digits beyond the 15th are replaced with zeros. That part is genuinely lost, not just hidden by formatting.

On screen this looks like a display quirk. It is not. The moment you press Save, Excel writes the mangled values back to disk. 2116 overwrites 02116; the rounded float overwrites your real ID. The original characters are gone, and no formatting change can bring them back.

The #1 rule: never double-click a CSV with IDs

If a file contains zip codes, barcodes, SKUs, phone numbers, account numbers, or any identifier that is "digits but not really a number," do not open it by double-clicking. Double-clicking triggers Excel's auto-detection with no chance to intervene. Instead, open a blank workbook first and import the file with type detection disabled. Importing gives you a checkpoint; double-clicking does not.

Inspect the raw file in your browser before Excel touches it

Here is the escape hatch most guides miss. Before you let any spreadsheet program near the file, look at the actual text. The raw CSV almost always still has your leading zeros intact, because corruption happens during Excel's import, not in the file. Confirming this first tells you whether you are recovering pristine data or already-damaged data.

You can do this privately, entirely in the browser, with no upload. Open the file in a plain text editor, or paste the contents into a client-side parser like our CSV to JSON converter to see each field exactly as stored. If 02116 shows up as "02116" in the parsed output, your source is fine and you just need a safe import path. If you need to isolate or rebuild one column, the text column extractor pulls a single field out cleanly, and if your file is actually tab- or pipe-delimited rather than comma-delimited, the TSV/PSV converter normalizes the structure first. None of these tools send your data anywhere; everything runs locally in the page.

Do this check first because of the asymmetry: a healthy source can always be re-imported correctly, but once Excel re-saves a damaged file, recovery is usually impossible.

Three reliable fixes inside Excel

1. Data > From Text/CSV with type detection off

This is the cleanest method. In a blank workbook, go to the Data tab and choose From Text/CSV. In the preview dialog, find the data type detection setting and choose Do not detect data types (the exact wording varies by version, but the option exists in the import preview). Excel then loads every column as text, leading zeros and full-length IDs preserved. This routes through Power Query and is the most robust option for files you import repeatedly.

2. Text to Columns, set the column to Text

If data already landed in a sheet but you have not saved yet, you can sometimes recover by re-parsing. Select the affected column, go to Data > Text to Columns, choose Delimited, click through to the final step, and set the destination column format to Text before finishing. Be aware: if Excel already rounded 16-digit IDs into floats on the initial open, those extra digits are already gone, and Text to Columns cannot restore them. It reliably fixes leading zeros but not lost precision.

3. Pre-format the cells as Text, then paste

For smaller jobs, open the raw file in a text editor, select all, copy, then in Excel select your target range, set the cell format to Text via Format Cells, and paste. Because the cells are already typed as text, Excel skips numeric coercion. A common shortcut for individual cells is prefixing a value with an apostrophe ('02116), which forces text and is not saved as a literal character in CSV exports.

Saving without re-breaking it

Fixing the view is only half the battle. When you save back to .csv, confirm the cells are still text-formatted, then verify the output. Reopen the saved file in a text editor or paste it back into a browser-based parser and check that 02116 is still five characters. Excel can re-coerce on export too, so never trust the on-screen value as proof; trust the bytes in the file.

Copy-paste recovery checklist

  1. Stop. Do not click Save on any copy of the file that is open in Excel.
  2. Make a backup copy of the original CSV before doing anything else.
  3. Open the raw file in a text editor or a client-side parser and confirm whether the leading zeros and full IDs are still intact in the source.
  4. If the source is intact: close any broken copy without saving, then re-import using Data > From Text/CSV with type detection turned off.
  5. If 16-digit IDs already show as 1.23457E+15 in a saved file, treat that data as lost and recover from the backup or original export instead.
  6. After fixing, save and then re-open the file as plain text to verify the zeros and digit counts survived.
  7. Going forward, never double-click a CSV containing identifiers; always import with detection off.

The pattern underneath all of this is that CSV has no type information, so any program that opens it has to guess. For the deeper mechanics of delimiters, encoding, and quoting that cause related headaches, see our CSV data handling guide. Treat the raw text as the source of truth, inspect it before Excel guesses, and you will stop losing zeros for good.

Frequently Asked Questions

CSV files store data as plain text with no type information, so Excel guesses each cell's type when you open the file. It reads 02116 as a number, and numerically 02116 equals 2116, so the leading zero is dropped. Once you save, that change is written permanently to the file.

Usually not if the file was already saved. Excel stores numbers as floating-point values and keeps only about 15 significant digits, so digits beyond that are replaced with zeros and genuinely lost. Recover from a backup or the original export. If the file was opened but never saved, re-import as text before saving.

Do not double-click the file. Open a blank workbook, go to the Data tab, choose From Text/CSV, and in the import preview select 'Do not detect data types.' Excel then loads every column as text, preserving leading zeros and full-length IDs. This is the most reliable method for repeat imports.

The raw CSV is almost always fine. Corruption happens during Excel's import and only becomes permanent when you save. Open the file in a text editor or a client-side parser to confirm the original values are intact, then re-import correctly. The damage is in Excel's interpretation, not the source bytes.

Yes, for manual entry. Typing '02116 forces Excel to treat the value as text, so it keeps the leading zero. The apostrophe is a display marker, not stored as a literal character when exporting to CSV. For whole files, importing with type detection off is faster than apostrophes.