Skip to content

Notebook · 2026-11-08 · updated 2026-11-08

How to keep leading zeros in a CSV

Stop ZIP codes, SKUs, and account numbers like 00120 from becoming 120. Read the file as text, clean it without numeric coercion, and open Excel the safe way.

The zero is usually still in the CSV. It disappears when a spreadsheet opens the file and decides the column is a number. CleanCSV keeps the characters through trim, text sort, and export. Excel will still guess again if you double-click the download.

What 00120 actually is

Name,Code
Ada,00120
Grace,00120
Ada,120

Exact duplicates remove only the second 00120 row.
Ada,120 stays, because it is different text.

Product codes, ZIP codes, and short account numbers are identifiers. Treating them as integers destroys meaning. A numeric sort in CleanCSV may order 00120 as one hundred twenty, but the cell text stays 00120.

Clean without coercing

  1. Open the file on the home page or drop it into the CSV viewer.
  2. Trim outer spaces if padding is creating fake uniqueness. Internal spaces and leading zeros stay.
  3. Remove exact duplicate rows only after the grid is correct. See the duplicate-row guide.
  4. Download with a UTF-8 BOM if the next stop is Excel on Windows. The BOM helps accents. It does not stop type guessing.

Open Excel without stripping the zeros

In Excel, use Data → From Text/CSV, open the cleaned file, set the identifier columns to Text in the preview, then load. Do not double-click the CSV. Microsoft documents the same idea for leading zeros and long numbers. If the zeros are already gone from a previous save, pad by guesswork is unsafe unless the source system defines a fixed width.

CleanCSV does not invent missing zeros. If the export already wrote 120, only the system that owns the identifier can restore 00120.

Ready to try it on a real file? The work stays in this tab.