An identifier such as 00123 is text, even though it contains only digits. If Excel interprets it as a number, the zeros disappear. For long identifiers, numeric conversion can also alter digits beyond the supported precision.
The safest fix is to control the import before that conversion happens. A display format can make a short number look padded, but it does not restore a damaged original identifier.
In this guide

Import the ID column as Text
Use Excel's Data > From Text/CSV workflow rather than opening the CSV by double-clicking it. In the import or query editor, identify the ID columns and set their data type to Text before loading the data.
Inspect any automatically added Changed Type step. If a prior step has already converted a long ID to a number, changing a later step back to Text may preserve the damaged value. Change or remove the conversion at the point it happens and check against the original CSV.
Microsoft's guide to leading zeros and large numbers describes text imports and the automatic-conversion controls available in recent Excel versions. The menus vary by version, so the key requirement is the resulting Text type, not a particular screenshot.
Three approaches that solve different problems
| Approach | Appropriate use | Important limit |
|---|---|---|
| Import as Text | Preserve original IDs, including long ones | Must happen before damaging numeric conversion |
| Custom format such as 00000 | Display a known short numeric code with five places | Changes appearance, not the underlying number |
| Add zeros to a text output | Reconstruct a known fixed-width code | Cannot determine unknown original length or recover rounded digits |
If the source specification says every branch code has five digits, converting 12 to 00012 may be reasonable. If you do not know whether the original was 12, 012 or 0012, padding is a guess.
Use the practice workbook
The IDs sheet contains four fictional examples: a postcode with leading zeros, a 17-digit account identifier, a short code with a known width and an alphanumeric product code.
Column A preserves the source as text. Column C is optional and should contain a width only when it is known. Column D pads to that width, while leaving IDs without a width unchanged. If the source is already longer than the specified width, it asks you to check rather than truncating it.
The sample 00123 stays 00123. The 17-digit identifier remains unchanged. The known five-digit code 12 becomes 00012. A012 remains an alphanumeric identifier.
Why a leading apostrophe is not a complete import process
Typing an apostrophe before an individual value tells Excel to treat that entry as text. It can be useful for a few manual entries, but it is not a substitute for defining a whole imported column correctly.
Also remember that CSV has no spreadsheet cell formatting. Saving a workbook as CSV and reopening it by double-clicking can trigger interpretation again. To test the exported characters, inspect the CSV as text or reimport it with the ID column explicitly set to Text.
Can missing digits be recovered?
If only leading zeros were removed and the required fixed width is known, padding may reconstruct the intended code. If a long identifier was rounded or otherwise changed during numeric conversion, the workbook cannot recover its original digits. Obtain a fresh source export and import it correctly.
Do not send a reconstructed identifier downstream until you have checked it against the source. A plausible-looking account or customer ID can still point to the wrong record.
A quick import check
Compare the row count, the first and last few IDs, examples beginning with zero and the longest identifiers. Use ISTEXT to check the loaded type and compare exact characters against the source. Include these cases in your repeatable import procedure so the next file does not bring the same problem back.