Skip to main content
← All guides

5 min read

EAN, GTIN and lost zeros in Excel: keep your codes intact

By Quentin Delepierre, Salesforce Commerce Cloud consultant

You open a product file in Excel and your barcodes turn into "3.61235E+12". It's not just a display issue: when the file is saved as CSV, the digits are lost. Here's what happens and how to avoid it.

Got your own XML? Drop it in and see it as a table, free and with no account. For an Excel file you can edit and then rebuild into an XML that keeps its structure, a free account is all you need.

Transform a file

Simple Excel table, free with no account, for files up to 1 MB. File that rebuilds into XML: free account, 3 free credits, no credit card.

Download an example result (.xlsx)Example source XML

The symptoms

  • An EAN-13 such as 5060155242347 shows as "5.06016E+12".
  • A UPC starting with zero, 060155242347, becomes 60155242347. An item code "00123" becomes 123.
  • A size "1-2" becomes "2-Jan". A date "2026-09-01" is shown in your regional date format.

Why the digits are lost

Opened by double-click, a CSV is read by Excel as if you typed each value: anything that looks like a number becomes a number, anything that looks like a date becomes a date. A number has no leading zero, and beyond 11 digits Excel shows it in scientific notation.

While the file is open, the full value still exists in the cell. But when saving as CSV, Excel writes what it displays: "5.06016E+12" goes into the file, and the last digits of the code with it. The file can no longer be repaired from itself.

The simplest: the Excel file (.xlsx)

After a transformation on ExcelifyXML, the result screen first offers an Excel file (.xlsx), for the same credit as the CSV. Every value in it is written as text and every column is in Text format: EANs, leading zeros, dates and true / false stay exactly as in the XML, and what you type stays text. It opens in Excel, LibreOffice, Google Sheets or Numbers, with no import or setting.

Excel may show small green triangles on the cells you type: it flags a number stored as text, it's intended. Never click "Convert to Number". To rebuild the XML, drop the saved file, alone, on the Rebuild page. Numbers removes the hidden sheet that holds the structure when it saves: then drop the file with its skeleton.json (link on the result screen, or in the .excelify.zip), in "Separate files".

The methods below are for the CSV, if you prefer it (scripts, other tools).

The right way to open the CSV

  1. In Excel, open a blank workbook, then Data › From Text/CSV, and pick the file.
  2. Click "Transform Data". In the editor, select the code columns (EAN, GTIN, UPC, SKUs) and give them the Text type. Replace the type if Excel asks.
  3. Click "Close & Load": the codes arrive as they are, zeros included.
  4. After your edits, save as CSV: text columns are written without conversion.

Excel 365 and 2024 settings

Excel for Microsoft 365 and Excel 2024 (Windows and Mac) have "Automatic Data Conversion" options: File › Options › Data on Windows, Excel › Preferences › Edit on Mac. Turn off the removal of leading zeros and the conversion of date-like combinations: leading zeros and sizes such as "1-2" are then kept, even by double-click.

These options don't protect an EAN-13: it stays a number, shown in scientific notation. For 12- and 13-digit codes, importing as Text is still needed — or take the Excel file (.xlsx).

What ExcelifyXML does

  • On transformation, the result screen lists the columns Excel is likely to change: leading zeros, codes of 12 digits or more, values Excel would take for dates.
  • On reconstruction, if a code turned into scientific notation or a date changed format, reconstruction stops and shows the columns, rows and an example. You fix it, or rebuild anyway knowingly.
  • Lost leading zeros are put back on reconstruction when every code in the column has the same length (EAN, UPC, GTIN, postal codes): the reconstruction page says how many values were completed. When the lengths vary, the zeros can't be put back exactly: the reconstruction stops.

Variant: the standalone Excel workbook

Like the Excel file (.xlsx), the standalone Excel workbook (2 credits) writes all data as text. It also regenerates the XML in Excel, on your computer, offline, without coming back to the site.

It already happened: how to fix it

Leading zeros removed from a column of codes of one length are repaired by the reconstruction itself. Other lost digits (scientific notation) can't be found in the damaged CSV. Go back to the original data.csv, which is in the downloaded bundle, or to the original Excel file (.xlsx) if you downloaded it, where the codes are intact: open the CSV with the method above, copy the code column and paste it into your edited file, as long as you haven't sorted or deleted rows in the meantime. Otherwise, redo your edits on a CSV opened correctly.

Turn your XML into an Excel file where everything is text, or a CSV with risky columns flagged:

Transform a file