Keep leading zeros when opening a CSV in Excel
The CSV still has 00123 – Excel converts it to the number 123 while opening. Once saved, the zeros are gone from the file too. Here's how to prevent it.
Updated 2026-10-26 · 4 min read
Option 1: turn off the conversion (Microsoft 365 / Excel 2024)
File › Options › Data › Automatic Data Conversion › untick Remove leading zeros and convert to a number. Microsoft documents this for Excel for Microsoft 365 and Excel 2024, including Mac. It applies to opening CSVs and to typing.
Option 2: import the column as Text
Data › From Text/CSV › Transform Data › select the column › Data Type: Text › Close & Load. Works in every recent Excel version and is safe for files you open repeatedly.
Option 3: deliver an .xlsx instead of a CSV
If you produce the file for others, send .xlsx with the column stored as text. Rowlode's Excel export keeps values with leading zeros and long IDs as text automatically, while real numbers stay numbers – and it works on files far beyond Excel's row limit (split into sheets or files).
Don't do this
- Don't open, edit and re-save the CSV in Excel without one of the fixes – the zeros are lost in the file.
- Prefixing values with an apostrophe or
="00123"works in Excel but pollutes the data for other systems.
Have a big or messy CSV? Rowlode opens CSV files with millions of rows (multi-GB) in your browser, reading them from disk – filter, remove duplicates, sort, fix delimiter and encoding, and export CSV, Excel (split under the row limit), TSV, JSON or NDJSON. Nothing is uploaded. Viewing, filtering and dedupe are free; each export holds the first 10,000 rows until you buy a $12 lifetime license.
Questions and answers
Why do ZIP codes like 02134 lose the 0?
Excel sees a number and stores 2134. Import the column as Text or turn off the automatic conversion.
Will Google Sheets keep them?
Sheets also converts by default. Import with 'Convert text to numbers, dates and formulas' turned off.
Sources and product names: Microsoft Support: "Keeping leading zeros and large numbers" and "Data import and analysis options in Excel" (checked 2026-10-26). Microsoft Excel and Power Query are trademarks of Microsoft; Google Sheets is a trademark of Google. Rowlode is independent and not affiliated with them.