How-to guide

How to Fix CSV Files Broken by Excel

Excel converts CSV values on open, not on save, so the damage happens before you notice it. Leading zeros disappear from postcodes and product codes, dates are rewritten into the local format, numbers longer than fifteen digits become scientific notation, and UTF-8 accents turn into mojibake. The fix is to import rather than open, forcing every column to text.

CSV to JSON Converter

Turn CSV rows into a clean JSON array of objects.

Open the tool

The critical detail is that Excel guesses a type for every column the moment the file opens, and that guess is destructive. Once a postcode has lost its leading zero the original value is gone; saving the file afterwards writes the damaged version back to disk.

This is why an export that was correct on the server arrives corrupted in a colleague's spreadsheet. Nothing in the pipeline was broken except the act of double-clicking the file.

Step by step

  1. Never double-click the file

    Open Excel first, then use Data, then From Text/CSV. This gives you the import dialog, which is the only place you can override the type guessing before it happens.

  2. Set every column to Text

    In the import preview, select all columns and set the type to Text. Nothing is lost by importing as text — you can convert deliberately afterwards — whereas anything Excel converts automatically is unrecoverable.

  3. Choose UTF-8 explicitly

    Set the file origin to 65001: Unicode (UTF-8). Without this, an accented name such as Müller is read as Windows-1252 and becomes Müller. A file that opens correctly on one machine and not another is almost always this.

  4. Check the four usual casualties

    Look at a postcode or product code with a leading zero, a date column, an ID longer than fifteen digits, and any non-English name. If all four survived the import, the rest of the file is almost certainly fine.

  5. Work outside the spreadsheet where you can

    If the goal is to reshape or convert the data rather than to look at it, skip Excel entirely. A converter reads the CSV as text throughout and cannot silently retype a column.

Example

The same three rows before and after Excel guessed the column types.

Original CSV

code,ordered,barcode
00421,2026-03-04,9780306406157
00088,2026-11-12,9781861972712

After Excel opened it

code,ordered,barcode
421,04/03/2026,9.78031E+12
88,12/11/2026,9.78197E+12

Frequently asked questions

Why does Excel remove leading zeros from my CSV?
Because it decides the column is numeric, and 00421 as a number is 421. It is not a display setting — the value itself is replaced. Importing the column as Text prevents the conversion, and formatting the cell afterwards does not bring the digits back.
Why do long numbers become 9.78031E+12?
Excel stores numbers with fifteen significant digits. Anything longer — barcodes, IMEIs, some order IDs — is converted to scientific notation and the extra digits are lost permanently. Such values are identifiers, not quantities, so they belong in text columns.
Why do accented characters turn into strange symbols?
The file is UTF-8 but Excel read it as Windows-1252, so each multi-byte character is shown as two or three wrong ones. Choosing 65001: Unicode (UTF-8) as the file origin during import fixes it, as does a UTF-8 BOM at the start of the file.
Does saving as CSV from Excel cause the same problem?
It writes out whatever is currently in the sheet, so if the damage happened on open it is now written to disk. Excel also saves in the local encoding by default, which can introduce mojibake in a file that was previously clean.
Is there a way to keep double-clicking safe?
Not reliably. You can rename the file to .txt so Excel always shows the import dialog, which works but is easy to forget. Doing the conversion outside the spreadsheet is the only approach that does not depend on everyone remembering.

Tools used in this guide

All tools →
All guides →

Last reviewed .