Recover EAN codes broken by Excel

Lost leading zeros can be put back, and the check digit proves which ones are right. Digits that turned into scientific notation cannot.

Drop your file here

or

CSV, TSV, TXT, JSON, XLSX, XLS · up to 200 MB

Processed locally in your browser: no data is uploaded.

No file at hand? Try a broken sample file:

What changes in your file

Four real examples. Red is how it is now, green is how you download it.

  • Broken accents

    CittàCittà
  • Leading zero dropped by Excel

    804482905589808044829055898
  • US date format

    03/15/202415/03/2024
  • Decimal separator

    1.234,561234.56

CSVMend works out what needs fixing on its own: load a file and you get the list, with the number of cells it corrected.

Almost every answer you find says the same thing: the zeros Excel removed cannot be recovered, start again from the original file. That is only half true. An EAN carries a check digit computed from the other digits, and that digit lets you verify a padding instead of guessing at it. Below: when recovery is possible, how the check works, and when the data really is gone.

What Excel did to your file

Excel reads anything that looks like a number as a number, and for a number a leading zero is worth nothing: 0012345678905 becomes 12345678905. The damage does not happen when you save, it happens when you open: one double click on the CSV and the conversion has already run, before you touch anything.

There are two different kinds of damage, and the difference matters because only one of them can be undone. The first is lost leading zeros: the meaningful digits are still there, only the padding in front is missing. The second is scientific notation, the 8.04483E+12 that shows up on long codes: there Excel rounded the number to about fifteen digits of precision, and the trailing digits no longer exist anywhere in the file.

When the code can still be recovered

An EAN-13 left with 11 or 12 digits is recoverable: only the zeros in front are missing, and the check digit lets you verify which ones. A fixed-length code with no check digit — a postcode, an internal code that is always six digits — can also be rebuilt, but by inference from the column’s dominant length, not by proof.

A code that turned into scientific notation cannot be recovered, by CSVMend or by anything else: the digits were discarded and the only way back is a fresh export from your system. If the column shows values like 8.04483E+12, those rows are gone, and no honest tool will tell you otherwise.

How the check digit turns a guess into a certainty

The last digit of an EAN-13 is not data: it is the result of a calculation on the other twelve. The digits are multiplied alternately by 1 and 3 and added up, and the check digit is the one that brings the total to the next multiple of ten. That is why a wrong EAN can be spotted without having the catalogue at hand.

CSVMend uses exactly that. On a column recognised as EAN it takes the values left between 9 and 12 digits, pads them with zeros to thirteen, and keeps the result only if the check digit works out. Take 12345678905: padded to 0012345678905 it sums to 85, so the check digit is 5, which really is the last digit of the code. The padding is correct, so it is applied.

The consequence that matters is the other one: when the check fails, the value is left alone. A price, a quantity or a code that is not an EAN is never padded with zeros by accident, because the arithmetic would not work out. The tool would rather leave a broken value than invent a plausible one.

Why the usual advice is not enough

The most common answer is the formula TEXT(A2,"0000000000000"), which pads with zeros up to thirteen digits. It works, but it pads anything: if a row held a code in a different format, or a value that was never an EAN, the formula turns it into a wrong code that looks perfectly normal. Nobody notices until the marketplace rejects the upload.

The other answer is “start again from the original file”. That is the right advice when you still have the original. People who land on this page usually received the CSV from a supplier, opened it for a look and saved it: the original is gone, and the forum threads end with codes being fixed by hand, one at a time.

How to stop it happening again

Never open a CSV of codes with a double click. In Excel use Data › From Text/CSV, set the code column to Text, then load: the values come in as strings and no conversion runs. Recent Microsoft 365 versions also let you switch automatic data conversion off under File › Options › Data.

If the file has to go back into Excel after cleaning, export it as .xlsx rather than CSV: code columns are written as text and stay text when reopened. For CSV the same result comes from the Excel guard, which writes the value as ="0012345678905".

How to stop Excel from ruining leading zeros →

How to clean a CSV file in 3 steps

  1. 1

    Load the file

    Drop a CSV, TSV or Excel file. Encoding and delimiter are detected automatically.

  2. 2

    Check the preview

    Toggle rules on and off and see exactly what changes, cell by cell, in real time.

  3. 3

    Download the result

    Export to CSV (UTF-8, with or without BOM) or Excel .xlsx with code columns stored as text.

What CSVMend fixes

Corrupted accents and symbols

Detects UTF-8, Windows-1252 and ISO-8859-1 and fixes sequences like é, è, €.

Leading zeros

Protects ZIP codes, EANs, VAT numbers, bank codes and phone numbers, and restores zeros Excel already removed.

Delimiters and formats

Converts between comma, semicolon, tab and pipe; normalises dates and decimal separators.

Messy spaces and rows

Removes extra spaces, line breaks in cells, invisible characters, empty and duplicate rows.

Total privacy: your data stays on your computer

CSVMend is a 100% client-side application. Your file is read and processed in your browser’s memory with JavaScript: there is no server receiving it, it is never stored in a database and never shared with third parties. You can even go offline after loading the page and the tool keeps working. Ideal for price lists, customer records and bank statements covered by GDPR.

Frequently asked questions

How do I know whether my EAN codes can be recovered?

Look at the column. If you see 11- or 12-digit codes where you expect 13, only the zeros in front are missing and they can be put back. If you see values like 8.04483E+12, Excel discarded the trailing digits and they no longer exist in the file: those rows have to be exported again from your system.

Can CSVMend add zeros to a code that was already correct?

No. The padding is kept only when the EAN check digit works out, and a complete code is never touched because it already has thirteen digits. A value that is not an EAN — a price, a quantity — fails the check and is left as it is.

What about postcodes or SKUs, which have no check digit?

There is nothing to prove there, so CSVMend is more cautious: it pads with zeros only up to the column’s dominant length, the one the other codes in the same field have. That is a reasonable inference, not a certainty like the EAN: on those columns it is worth a look at the preview.

How is this different from the leading-zeros page?

The intent. That one comes first, to stop Excel from ruining codes when you open or save the file. This one comes after, when the damage is done and you need to know what can still be rebuilt.

Is my file uploaded to a server?

No. All processing happens in your browser. The file never leaves your device and no data is stored.

Is CSVMend free?

Yes, it is free and needs no sign-up. The service is supported by non-intrusive ads.