Skip to content
FastTool

How to keep leading zeros and long IDs when opening a CSV in Excel

Double-clicking a CSV lets Excel strip leading zeros, turn codes like 03-04 into dates, and zero out every digit past the fifteenth.

Updated · Uses the free CSV Cleaner & CSV to Excel, which runs in your browser

Short answer

Do not double-click the CSV file. Open it in CSV Cleaner & CSV to Excel, choose Preview & clean, then choose Download Excel (.xlsx). Every cell is written as explicit text, so 00123 keeps its zeros and 20-digit tracking codes keep all 20 digits. You can also import the CSV inside Excel with Data › From Text/CSV and set ID columns to Text.

Open the CSV Cleaner & CSV to Excel

Four silent changes Excel makes when you double-click a CSV

A CSV file is plain text with no column types. When you open it directly, Excel guesses each cell’s type and rewrites four kinds of values:

What sits in the CSV versus what Excel stores after a double-click
Value in CSV Example use Double-clicked in Excel Saved back to CSV
00123 or 07401 Customer ID, US ZIP code, UK phone 123 or 7401 Leading zeros are gone for good.
12345678901234567890 20-digit parcel, barcode or card ID 1.23457E+19 12345678901234500000 (last 5 digits lost).
03-04 or 10/12 Bin location, size range, part code 4-Mar or 12-Oct Rewritten as a date in your computer’s format.
=1+1 or - Rush order Customer note starting with = or - 2 or #NAME? Calculated value or error text replaces the note.

Formatting a damaged column as Text afterwards cannot bring back lost zeros or the last five digits of a 20-digit code. Excel stores numbers in IEEE 754 floating-point format, which holds only 15 significant digits.

Method 1: Convert the CSV to a text-typed .xlsx file first

The fastest fix when sending a file to colleagues is to hand Excel an .xlsx workbook where every cell is already marked as text:

  1. Open CSV Cleaner & CSV to Excel and drop your CSV or TSV file (up to 5 MB and 50,000 rows). Nothing is uploaded.
  2. Leave cleanup checkboxes off if you want every row untouched, or tick trimming, blank-row removal and duplicate removal.
  3. Choose Preview & clean to check the row and column counts.
  4. Choose Download Excel (.xlsx). Every cell is saved as an ECMA-376 inline string with the @ text format.

Try it with Try an example on the tool page. The six-row sample holds 00123, 00007, 12345678901234567890 and the note =1+1. With trimming, blank removal and duplicate removal ticked, 6 rows become 4 clean rows, and all four tricky values open in Excel unchanged.

Method 2: Import inside Excel with From Text/CSV

If your CSV is larger than 5 MB or you want a repeatable query inside Excel, use Power Query instead of File › Open:

  1. Open a blank workbook in Excel and choose Data › From Text/CSV.
  2. Pick your CSV file. In the preview window, check that File Origin says 65001: Unicode (UTF-8) so accented names stay intact.
  3. Do not click Load yet. Under Data Type Detection, Excel checks only the first 200 rows by default.
  4. Choose Do not detect data types (or choose Transform Data, select your ID, ZIP and code columns, and set Data Type: Text).
  5. Choose Close & Load. Every column marked as Text keeps its leading zeros and all 20 digits.

In Microsoft 365 and Excel 2024+, open File › Options › Data (or Excel › Preferences › Edit on a Mac). Untick Remove leading zeros and convert to a number and Keep first 15 digits of long numbers and display in scientific notation.

Common mistakes

  • Saving an .xlsx sheet back to CSV and double-clicking it again. A CSV cannot store column types, so reopening the new CSV repeats the same conversion.
  • Applying Custom format 00000 to variable-length codes. That pads five-digit ZIP codes visually, yet fails on mixed codes such as 04 and 00412, and never fixes 16-digit truncation.
  • Trusting the first 200 rows in Power Query. If rows 1 to 200 hold plain digits and row 250 holds 00412, automatic detection still turns row 250 into 412.
  • Skipping a before-and-after check after an export. Drop the original CSV and your saved sheet into Compare Two Spreadsheets to catch any altered IDs at once.

When this method is the wrong choice

If your table sits inside a PDF statement rather than a CSV, start in PDF Table Extractor. Its Excel download keeps plain amounts as numbers you can add up while keeping reference codes like 00417 as text.

Sources

Spotted a mistake in this guide? Email contact@fasttool.app. We reply within 7 business days.

Open the CSV Cleaner & CSV to Excel