How to Fix Missing Leading Zeros in a CSV in 3 Steps
-
Add your CSV
Drop the file onto the box, or paste the rows as text. The tool detects the delimiter and the file encoding by itself. It reads CSV, TSV and TXT files. For an .xlsx file, use Save As > CSV first.
-
Check the column settings
ZIP columns, ID-like columns and anything stored in scientific notation are pre-selected. Change a column to US ZIP code, Pad to fixed width, or Scientific notation to full digits, and set the width for IDs.
-
Review the preview and download
Changed cells show the old value crossed out next to the new one. Cells that were zero-filled or are suspect are marked in orange. Download the .xlsx if you plan to open the result in Excel, or the CSV if it is headed for another system.
Why Excel Causes This Error: The Technical Root Cause
A CSV file is plain text. It has no column types, so "07001" is just five characters. Excel guesses a type for every cell when it opens the file, and the default General format turns anything that reads as a number into a number. A number has a value and no formatting, so the leading zero is dropped at that moment. Saving the workbook back to CSV writes the number, not the text you started with.
Long IDs fail in a second way. Excel stores a number as a 64-bit floating-point value, which holds 15 significant digits. A 16-digit card-style ID or a 20-digit tracking number is rounded to 15 digits and padded with zeros. When the column is narrow, General format also displays the number in scientific notation, and a CSV saved from that sheet can carry the shortened display text such as 1.23457E+11 instead of the digits you typed.
That is why the two problems need different repairs. A dropped zero is predictable: a US ZIP code is always five digits, so 7001 can only be 07001. Digits lost to rounding are not predictable, so the tool rebuilds what the file still contains and flags every cell where it had to fill in zeros.
Manual Method vs GridFix Browser Tool Comparison
| What you need | Manual Excel method | GridFix browser tool |
|---|---|---|
| Repairs a file Excel already damaged | No. The zeros are not in the file any more, so you rebuild them by formula. | Yes. Pads ZIPs and IDs back to the width you set. |
| Scientific notation (1.23E+11) | Cannot be undone. Changing the cell format does not bring back digits. | Rebuilds the digit string and tells you which cells were zero-filled. |
| Steps per file | Import wizard, set column types, or add a helper column with TEXT() and paste values. | Drop file, check columns, download. |
| Zeros survive the next open in Excel | Only if you keep the column formatted as Text or Custom. | The .xlsx download stores restored columns as text. |
| Privacy | File stays on your computer. | File stays on your computer. Processing happens in the browser tab. |
| Cost | Free with Excel. | Free, no sign-up. |
If you still have the original export, the import wizard (Data > From Text/CSV, column type Text) is the cleanest fix because the zeros never leave. Use this tool when all you have is the damaged file.
Frequently Asked Questions
How do I stop Excel from removing leading zeros when I open a CSV?
Do not double-click the file. Open a blank workbook, go to Data > From Text/CSV, choose the file, click Transform Data, select the ZIP or ID column and set its type to Text before loading. Excel then keeps 07001 as written. If the file is already damaged, drop it into this tool and it pads the values back.
Why does Excel change 07001 to 7001?
A CSV file has no data types. When Excel opens it, every cell that looks like a number is stored as a number, and a number has no leading zeros. The zero is gone the moment the file opens, and it stays gone when you save over the CSV.
Can this tool recover digits when Excel turned an ID into 1.23E+11?
It can rebuild the full digit string, but only the digits that are still in the file. 1.23457E+11 contains six digits, so the tool writes 123457000000 and marks the cell as zero-filled. Excel keeps just 15 significant digits, so anything longer than that was already rounded before you got the file. Re-export from the original system when you need the real digits.
Will the zeros disappear again when I open the fixed CSV in Excel?
Yes, if you double-click a CSV, Excel strips them again. That is why the tool also offers an .xlsx download where the restored columns are stored as text. Open that file and the zeros stay. Use the CSV when the file is going into a database, an import tool or another system.
Is my file uploaded to a server?
No. The file is read and rewritten by JavaScript inside your browser tab. Nothing is sent to GridFix or anyone else, and you can disconnect from the internet after the page loads and it still works.
Does this work for Google Sheets exports?
Yes. Download the sheet as CSV, drop it in here, and pick the columns to repair. To avoid the problem in Sheets itself, use File > Import and untick "Convert text to numbers, dates, and formulas".