DocDori

When Excel drops the leading zeros from ‘0012’

Last updated 2026-11-10

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

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

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.

Try it in the workspace