Preserve leading zeros when converting CSV/JSON (no upload)
How to preserve leading zeros (IDs, zip codes) when moving between CSV, JSON, and Excel—without uploading your data.
Why leading zeros disappear
Excel aggressively treats values as numbers. When it guesses a column is numeric, 00123 becomes 123.
If you export that back to CSV, the zeros are permanently lost unless you kept the original text representation.
Best practice: keep IDs as strings
IDs, SKUs, and zip codes should usually be strings. JSON supports strings natively, and CSV can represent strings by quoting values.
When converting CSV to JSON, ensure the values remain strings if leading zeros matter.
- Treat ID-like fields as strings (even if they look numeric).
- Avoid Excel auto-format by importing as text when possible.
Validate before export
Convert a small sample and verify a few IDs at the top and bottom of the dataset.
Once the JSON is correct, you can safely copy or download it for downstream usage.
Excel-proof workflow (recommended)
The safest approach is to preserve the original text representation as long as possible, and only open the data in Excel after you’ve validated that IDs remain strings.
If Excel already removed zeros, go back to the source export (or the original CSV) and re-import with explicit “text” column types.
- CSV → JSON: keep ID-like fields as strings.
- JSON → CSV: ensure IDs are quoted if needed for spreadsheet import.
- Excel import: set the ID column to Text before loading data.
Trust note: All processing happens locally in your browser. Files are never uploaded.
FAQ
Can JSON store numbers with leading zeros? Numbers don’t keep leading zeros. Use strings instead.
Is this safer with no-upload tools? Yes—sensitive identifiers stay on-device.
Local verification snippet
Run a quick local check before export/convert:
import csv
from io import StringIO
sample = text[:50000] # keep first chunk for fast local triage
rows = list(csv.reader(StringIO(sample)))
print('rows:', len(rows), 'columns(first row):', len(rows[0]) if rows else 0)
Related by intent
Useful follow-up pages selected from real search impressions and no-click opportunities.
Related by winning cluster
Linked from a winner family to push crawl and first-impression conversion.
Quick fix checklist
- Reproduce the error on a minimal input.
- Check type/format and field mapping.
- Apply the smallest safe fix.
- Validate on production-like payload.
Next pages to check
Closest crawled pages without impressions yet. Added to speed first-impression conversion.