Start with a sample that exposes the problem
Download this small CSV test file. All entries are fictional. The postal codes, account IDs, and long references are identifiers, not quantities to add together.
postal_code,account_id,long_reference,amount
00501,000042,123456789012345678,12.50
02108,000007,9007199254740993,0.75The first row must retain 00501, 000042, and 123456789012345678 exactly. If you see 501, 42, or a changed final digit, inspect the import. Check the formula bar and an exported text copy rather than relying only on the width of the displayed cell.
Set column types before loading the data
- Keep an untouched CSV copy and open a blank workbook.
- In a supported desktop Excel version, choose Data → From Text/CSV.
- Use the transform/import option that lets you assign column types. Set identifier columns to Text.
- If Power Query added an automatic Changed Type step, remove or edit it so numeric conversion does not occur first. Start again from the untouched source when necessary.
- Load the data and compare the sample identifiers character by character.
Menus and conversion settings vary by version. Microsoft’s leading-zero and large-number guidance describes supported approaches. If your version uses a different import screen, select text for the identifier columns before the values are converted.
Display formatting is different from preserving text
A format such as 00000 can make the number 501 display as 00501. That may help with a known fixed-width code, but it does not establish what the source contained. The original could have been 00501, 0501, or 501.
Keep amounts numeric when arithmetic is needed. Keep identifiers as strings when their characters matter. A digits-only field can still be a label: a postal code, product code, telephone number, or account reference. Long identifiers require particular care because rounding may destroy information beyond leading zeros.
Why CSV quotation marks are not enough
CSV quotes delimit fields that contain commas, quotation marks, or line breaks. They do not declare a spreadsheet data type. An importer may still turn "000042" into a number. CSV also does not retain workbook cell formatting; reopening a saved CSV can trigger conversion again.
Avoid rewriting IDs as formulas such as ="000042" just to control one application’s display. That changes the actual field contents and may break the next importer. Use a controlled text import or a workbook with explicitly typed cells if the recipient supports it.
Verify an export before sharing it
- Save your workbook separately from the original CSV.
- Export to a new filename if CSV is required.
- Open the export in a plain-text editor. Compare the identifier fields against the untouched sample.
- Import that export with the same text-column rules. Check the row count and representative fields again.
Use Text Diff Checker for small, non-sensitive before/after samples. Differences in newline or quoting style may be harmless, so inspect field values separately. CSV Cleaner can help with deliberate cleanup but cannot infer an identifier already lost through rounding.
Check types when converting CSV to JSON
After using CSV to JSON, an exact identifier should generally appear as "account_id": "000042", not "account_id": 42. Confirm the receiving schema before changing types. A numeric-looking code and a monetary amount may need different handling in the same row.
Can I restore the original after saving the wrong values?
Only from a trustworthy source or an unambiguous documented format. Padding a known fixed-width code may restore its shape; it cannot recover arbitrary rounded digits. Reloading an untouched source is the safer fix.