Keep leading zeros when you open a CSV in Excel
Excel drops leading zeros because it converts codes like 02134 into the number 2134. The data is still in the CSV. Import with Data > From Text/CSV, click Transform Data, set the ZIP, ID or phone column type to Text, then Close and Load.
Do this in one click with LightCube Data Extractor, a free Chrome extension. No account needed.
Add to Chrome, free ↗Step by step
- Data > From Text/CSV and choose the file.
- Click Transform Data to open Power Query.
- Select the column with codes, then set Data Type to Text and replace the current conversion step when asked.
- Close and Load.
Google Sheets
Before pasting, select the target column and set Format > Number > Plain text. Then paste or import; zeros stay.
Long numbers
IDs longer than 15 digits, such as card-like or tracking numbers, lose precision in Excel as numbers. Import them as Text for the same reason.
Do not edit and resave carelessly
If you open a CSV by double-click, Excel removes zeros in memory. Saving then writes the file without them. Keep the original export.
FAQ
- Is the zero in the CSV file?
- Yes, check in a text editor.
- Can I add zeros back with a formula?
- Yes, for fixed-length codes:
=TEXT(A2,"00000"). - Does Copy and paste keep zeros?
- Excel still converts on paste unless the column is formatted as Text first.
Related guides
Updated 2026-11-11.