← Guides

TOOLDAM GUIDE

Why Excel turns 00123 into 123 in a CSV, and how to keep the zeros

We opened a CSV with order numbers and postal codes in Excel, watched the leading zeros disappear, and tested the import steps that keep them.

Key point

Double-clicking a CSV in Excel turned 00123 into 123 and 01234 into 1234, whatever the file's encoding. Import it with Data → From Text/CSV, change the column to Text, and choose Replace current: the zeros come back. Add new step does not bring them back.

What changed when we double-clicked the CSV

We opened a CSV of 10 sample orders in Excel for Windows by double-clicking it. The UTF-8 with BOM file and the Korean Windows (CP949) file gave the same result.

ColumnValue in the CSVValue shown in Excel
Order number00123123
Postal code012341234
Phone010-0000-1201010-0000-1201 (unchanged)
Order date2026-11-02Converted to a date
  • A CSV stores no column types. Excel guesses from the values, and 00123 looks like the number 123.
  • The phone number kept its zero because the hyphens stop Excel from reading it as a number.
  • Order numbers, postal codes and product codes are labels, not quantities: treat them as text.

How to open the CSV and keep the zeros

Set the column type yourself in Excel's import. Following these steps kept 00123 and 01234 in our test.

  1. Open a blank workbook, go to Data → From Text/CSV and choose the CSV.
  2. In the preview, choose Transform Data instead of Load. The Power Query editor opens.
  3. Click the '1²3' icon next to the order number column header and choose Text.
  4. When the Change Column Type dialog appears, choose Replace current. 00123 shows again.
  5. Do the same for any other column that needs its zeros, such as postal codes.
  6. Click Close & Load.

Why Add new step does not work

As soon as Excel loads the file it adds a Changed Type step that has already turned the order number into the number 123.

Add new step converts that 123 back to text, so you get '123'. Replace current changes the guessed type itself to Text, so Excel reads the original 00123.

If you already saved the file without the zeros

Saving a double-clicked CSV from Excel writes the 123 you see on screen. If you still have the original CSV, open that one with the steps above.

If every code has the same length, a formula can pad the zeros back: for 5-digit codes, =TEXT(A2,"00000") turns 123 into 00123. Codes of different lengths cannot be recovered this way.

Other values to watch

  • Numbers longer than 15 digits: Excel keeps only 15 significant digits, so long IDs read as numbers end in zeros. Import them as text.
  • Text that looks like a date, such as 3-4 or 1/2, may become a date.
  • Tooldam's CSV cleaner keeps every value as written, so 00123 stays 00123 in the saved file. Excel will still show 123 if you double-click that file, so open it with the steps above.