When Excel drops the leading zeros from ‘0012’
Why values that start with 0, such as product codes, postal codes and student IDs, turn into 12 in Excel, and how to keep them intact.
When you type product code 0012, postal code 01234 or a phone number starting with 010… into Excel, or open them from a CSV, the leading zeros often vanish. Excel treats these values as numbers, and in a number leading zeros carry no meaning.
How to keep them in Excel
- Put an apostrophe in front when typing. If you enter
'0012, the cell shows 0012 and stores it as text. - Change the whole column to Format Cells → Text before you enter anything.
- When opening a CSV, import it with Data → From Text/CSV instead of double-clicking, and set that column’s type to ‘Text’ under ‘Transform Data’ in the preview.
In DocDori
When DocDori opens a CSV, it doesn’t arbitrarily turn number-like values into numbers. 0012 stays 0012, and long numbers over 20 digits are kept exactly as written, with no rounding. In XLSX files too, 0012 stored as a string is saved back as a string.
Can lost zeros be recovered?
In a file where the value has already been saved as the number 12, the original digit count is gone, so it can’t be restored automatically. If the number of digits is fixed, you can rebuild the values in Excel with something like =TEXT(A1,"0000"), but getting the original file again is the most accurate option.
Values where this often happens
- Postal codes (01234), student and employee IDs (00123), product codes (0012)
- Lists of Korean mobile numbers starting with 010 saved without hyphens
- Card approval numbers or order numbers longer than 20 digits (Excel may even change the trailing digits to 0)
Frequently asked questions
What if I open a CSV fixed in DocDori in Excel again? DocDori saves 0012 as is, but Excel may turn it back into a number when you double-click the file. In Excel, open it with ‘Data → From Text/CSV’ and set that column to text.
Is saving as XLSX safe? If the cells are stored as text, 0012 is kept in XLSX too. Watch out for number cells that only have a 0000 display format applied: the value itself is still 12.