Leading zeros removed from CSV file? Restore them here

Drop or paste the file, set each column to ZIP, UPC, EAN or a fixed length, and get the zeros back, a list of rows scientific notation ruined, and an Excel file that keeps them as text.

Free tool · Ecommerce · Excel · Updated

1Add the file that lost its zeros

Use the original export if you still have it. Excel changes the file only when you save it.

Want this done on your whole Excel? We fix item, customer and vendor lists that break every time someone opens them in Excel on your real data, tested with you.

Walk us through your item or customer list

Why does Excel remove leading zeros from a CSV file?

Excel reads a cell made only of digits as a number when it opens a CSV, and a number has no leading zeros. Long numbers show in scientific notation, like 1.23E+15, and Excel keeps only 15 significant digits, so digits past the 15th become zeros.

A CSV stores no column types, so this happens every time the file is opened in Excel. Save the file from Excel and the shortened values are what gets saved.

Example: ZIP code 02134 opens as 2134. UPC 049634061230 opens as 49634061230.

How do you keep leading zeros in a CSV?

Import the file instead of opening it. In Excel, go to Data > From Text/CSV, open the query editor, set those columns to Text, then choose Close & Load.

  • Excel for Microsoft 365 and Excel 2024 have an Automatic Data Conversions setting that can stop Excel removing leading zeros.
  • An apostrophe before a number, like ‘02134, keeps it as text.
  • Square warns that spreadsheet editors can strip leading zeros from SKUs. Its import also takes .xlsx files.

The Excel file this tool gives you stores the fixed columns as text, so the zeros stay when you open it.

How do you add a leading zero back to a ZIP code in Excel?

Put =TEXT(A2,”00000”) in an empty column, fill it down, then paste the results back as values. ZIP+4 codes are five digits, a hyphen and four digits, so a 9-digit value needs =TEXT(A2,”00000-0000”).

Example: 2134 becomes 02134. 21341234 becomes 02134-1234.

The tool does this for a whole column at once, including columns that mix 5-digit ZIPs and ZIP+4.

Can you fix scientific notation like 8.5E+11 in a CSV?

Only when every digit is still in the file. The number of digits is the digits before the decimal point plus the exponent.

Formula: digits = digits before the point + exponent.

Example: 8.5E+11 has 1 + 11 = 12 digits, and only 2 of them survive: 85xxxxxxxxxx. That row has to be re-keyed from the original export, the vendor’s list or the product label.

If the sheet is still open in Excel and unsaved, format the column as Number with 0 decimal places to see the full value. That works up to 15 digits.

The tool lists every such row with its item name, so you can re-key them in one pass.

How does it check a restored UPC or EAN code?

It recomputes the GS1 check digit, the last digit of every UPC-A (12 digits), EAN-13 (13 digits) and GTIN-14. Multiply the other digits by 3 and 1 in turn, starting from the right, add them up, and subtract the sum from the next multiple of ten.

Example: for 04963406123, the weighted sum is 70, so the check digit is 0 and the full UPC is 049634061230.

A padded code that fails the check had a typo before Excel touched it. The UPC check digit calculator checks single codes, and our field guide on barcode inventory for a small warehouse covers the scanning side.

Questions

Is my file uploaded anywhere?

No. The file is read by your browser and fixed on your computer.

Why download the Excel file instead of the CSV?

A CSV has no column types, so Excel strips the zeros again the next time it opens it. The .xlsx stores the fixed columns as text.

What barcode lengths does Square accept?

Square says a GTIN must be 8, 12, 13 or 14 digits, numbers only. Its item import takes .xlsx and .csv files. For a barcode column that mixes UPCs and EANs, pick Mixed UPC and EAN.

Can it bring back digits lost to scientific notation?

Those digits are gone from the file itself. The tool lists each row so you can re-key it from the source.

Can I paste straight from Excel or Google Sheets?

Yes. Copy the cells with the header row and paste them in. The zeros come back once you set each column type.

Sources

Lines of light running into one large blue period

Walk us through one problem.

We’ll tell you what we’d fix first.

Walk us through one problem

Free. 30 minutes. A one-page note within two business days.