| Key facts | |
|---|---|
| Excel precision | 15 significant digits (Microsoft) |
| Scientific notation | Numbers of 12 or more digits in General format |
| Restore a zero | =TEXT(A2,"000000000000") |
| Lost for good | 7.61E+11 saved in a CSV |
Why does Excel change UPCs?
Because it treats them as numbers. Excel automatically removes leading zeros and converts large numbers to scientific notation, such as 1.23E+15, and it keeps only 15 significant digits, so digits past the 15th become zeros (Microsoft Support). Its General format shows numbers of 12 or more digits in exponential notation (Microsoft Support), which takes in every UPC, EAN and GTIN-14.
| What you see | What happened | Can it be fixed in the file? |
|---|---|---|
| 11 digits instead of 12 | The leading zero was removed | Yes: pad back to 12 digits as text |
| 7.61235E+11 | The display switched to scientific notation | Yes, while the cell still holds the number: format as text or use TEXT |
| 7.61E+11 in a CSV | The file was saved as displayed | No: ask the supplier to resend the column as text |
| A 16-digit code ending in 0 | Digits past the 15th were rounded to zero | No: ask for the original |
How do you open a supplier CSV without losing zeros?
- Do not double-click the CSV. In Excel, choose Data > From Text/CSV and pick the file.
- Choose Transform Data (Edit) to open the Power Query Editor.
- Select the UPC and part number columns, then Home > Transform > Data Type > Text, and choose Replace Current.
- Choose Close & Load. The codes keep every digit.
These are Microsoft's steps (Microsoft Support). Excel for Microsoft 365 and Excel 2024 also have an Automatic Data Conversion option that can stop Excel removing leading zeros and shortening long numbers.
How do you put a lost leading zero back?
In a new column, use =TEXT(A2,"000000000000") for 12-digit UPCs, or 13 or 14 zeros for EANs and GTIN-14s. TEXT pads the number with zeros and returns text, which Excel will not strip again (Microsoft Support). Then check the result: a restored UPC should pass the GS1 check digit test, which the UPC check digit calculator runs for you.
For codes you type in, format the cells as Text first, or type an apostrophe before the number.
What should you ask suppliers to send?
- UPC, GTIN and part number columns formatted as text before the file is saved
- One code per column, and a note of which level each code identifies (each, inner pack, case)
- An Excel file or a CSV opened from the original system, not one re-saved after opening in Excel
Our vendor price file template (CSV) lists the columns to ask for. The supplier price file errors guide covers the rest of what goes wrong.
How do I stop Excel removing leading zeros in a CSV?
Import the CSV instead of double-clicking it: use Data > From Text/CSV and set the UPC and part number columns to Text. Excel for Microsoft 365 and Excel 2024 also let you turn off the automatic conversion in Options. Excel strips zeros on open, so check the CSV in a text editor.
Which methods keep the zeros?
| Method | Keeps leading zeros? | Note |
|---|---|---|
| Double-click the CSV | No | Excel converts 00123 to 123 by default |
| Data > From Text/CSV, column type Text | Yes | Set each code column before loading |
| Turn off the automatic conversion | Yes | Stores such values as text; Microsoft 365 and Excel 2024 |
| Custom number format 000000000000 | Shows them | The cell stays a number; works under 16 digits |
| =TEXT(A2,"000000000000") | Yes | Rebuilds a 12-digit code as text |
Microsoft lists the conversions Excel applies when it opens a .csv file or receives pasted data, including removing leading zeros and keeping only 15 digits of long numbers, and how to disable each (Microsoft). Its leading-zeros article covers From Text/CSV, custom formats and the TEXT function (Microsoft).
How do I keep the zeros when saving Excel as a CSV?
Store the codes as text before saving, either by importing them as Text or rebuilding them with TEXT. Then reopen the saved file with From Text/CSV, since double-clicking it applies the conversion again on the way in.
What format should UPCs and GTINs take in a file?
Fixed length with every zero. In GS1 XML a GTIN is exactly 14 digits, right-justified and zero-filled whatever its length (GS1), so a sample UPC 012345678905 travels as 00012345678905. A file that keeps codes as text avoids both lost zeros and the scientific notation Excel applies to long numbers.
Common questions
Why does Excel turn my UPC into 7.61E+11?
Excel stores the UPC as a number, and its General format shows numbers of 12 or more digits in scientific notation. Format the column as text or import it as text.
How do I add back the leading zero to a UPC in Excel?
Use =TEXT(A2,"000000000000") in a new column. It pads to 12 digits and returns text.
Can I recover a UPC saved as 7.61E+11 in a CSV?
No. Only the digits shown were saved. Ask the supplier to resend the column formatted as text.
Does Excel change numbers longer than 15 digits?
Yes. Excel keeps 15 significant digits and changes the rest to zeros.
Why does Excel get rid of leading zeros?
Because by default it converts numeric-looking text to numbers when it opens a CSV or receives pasted data, and numbers have no leading zeros.
How do I stop Excel changing numbers when opening a CSV?
Import with Data > From Text/CSV and set the columns to Text, or turn off the automatic data conversions in Excel's options.
Does the setting affect Power Query?
No. Microsoft says the automatic data conversion options do not directly affect data imported with Power Query, which has its own data type settings.
First supplier file free. Pilot $500 for up to 5 files. Then $950 a month for up to 15 files, $60 per extra file. Every file back within 24 hours, or it is free.
Send your first file