# Keep leading zeros and long numbers from a CSV

> Postcodes, article numbers and long IDs keep every digit; prices and amounts stay numbers you can add up.

Human page: https://unmakelabs.com/en-us/csv-keep-leading-zeros/. This is the version for AI agents.

## What it does

Keep leading zeros in Excel from CSV: keep every leading zero and every digit Postcodes, article numbers and long IDs keep every digit; prices and amounts stay numbers you can add up.

## How Excel loses digits

On a double-click Excel turns anything that looks like a number into one: 02134 becomes 2134, an EAN becomes 4.00638E+12, and a 16-digit card or order ID loses its last digit for good, because Excel keeps only 15. This tool spots codes (leading zeros, 12+ digits of one length, +phone numbers) and stores them as text, so nothing changes.

## What you get

An Excel file with real numbers you can add up, real dates you can sort, and codes that keep every digit: postcodes and article numbers keep their leading 0, EANs, IBANs and 16-digit IDs stay exactly as written. The top row is frozen as the header; info lines above the table are kept. Or a CSV your Excel reads right, or a plain UTF-8 CSV for an import.

## Facts

- **Fixes:** Encoding (UTF-8, Windows-1252, UTF-16, Mac, garbled ‘Ã¼’), separator, decimal comma or point, dates, leading zeros, long numbers
- **Saves:** Excel .xlsx, CSV for Excel, plain UTF-8 CSV, JSON; Excel back to CSV
- **Checks:** Every cell read back from the Excel file, no digit lost, rows and columns counted
- **Privacy:** Read on your device; nothing uploaded

## How a person does it

1. **Drop the CSV.** Or tap Choose a CSV file. A bank, shop or open-data export of a few MB takes about a second.
2. **Compare before and after.** Top: what Excel shows on a double-click. Below: the fixed table, with every changed cell coloured. Change a column type under Adjust if needed.
3. **Download the Excel file.** Tap Download. The page has already read the file back and checked every cell.

## Open a file by link (works today)

The viewer runs in a browser. Any public file URL can be opened by adding `?src=` (URL-encoded): `https://unmakelabs.com/en-us/csv-keep-leading-zeros/?src=https://unmakelabs.com/apps/csvfix/samples/marches-publics.csv`. The host must allow cross-origin reads (GitHub raw, most object storage and CDNs do). A camera view can be added after `#`: none: the file never goes in a link. `?src=<public CSV URL>` opens a file the visitor's browser can fetch (CORS).

Embed: `<iframe src="https://unmakelabs.com/embed/csvfix/?src=<url-encoded file URL>" width="100%" height="480" style="border:0"></iframe>`.

## Send your own file (live)

`POST https://y64b3d8qbc.execute-api.eu-central-1.amazonaws.com/v1/csv_fix/jobs?wait=25` with the file as multipart `file` (or JSON `file_base64` + `filename`, or `file_url`), API tool `csv_fix`: Fix a CSV for Excel (encoding, separator, decimals, dates, leading zeros). The same engine code as this page. No sign-up; Free: 5 full results per IP per day without a key (resets at 00:00 UTC); POST /v1/keys gives an instant key with 25 more full results (one-time, not renewed); each accepted correction adds 1 free call (up to 20 a month). Options (JSON in `options`): `locale`: e.g. de-de: separator/decimal of the CSV-for-Excel file and the date-order fallback (default en-us); `encoding`: force an encoding (utf-8, windows-1252, iso-8859-15, windows-1250, macintosh, utf-16le); `delimiter`: force the separator (; , | or a tab); `header`: header row index, -1 for none; `types`: per column: {"3": "text"|"number."|"number,"|"DMY"|"MDY"}.

```bash
# CSV to a typed .xlsx + report
curl -s -F "file=@export.csv" -F 'options={"locale":"de-de"}' "https://y64b3d8qbc.execute-api.eu-central-1.amazonaws.com/v1/csv_fix/jobs?wait=25"
```

## Good to know

Detection is automatic and shown with its reason under Details. When dates only have days up to 12, the order (day or month first) is a guess from the rest of the file; the column is marked so you can switch it in one tap. Tested on 74 real public CSV exports from 18 countries and 200 generated files: every cell read back from the Excel file, no digit lost.

## Not done by this tool

- Doesn't change your data: it reads it right, it doesn't clean or dedupe it
- Doesn't open files over 50 MB in the browser
- Doesn't read PDFs (use PDF tables to Excel) or old .xls
- Doesn't merge several CSV files

## Value

Fixes a CSV so it opens right in Excel, in the browser: reads the encoding from the bytes (UTF-8 with or without BOM, UTF-16, Windows-1252, ISO-8859-15, Windows-1250, Mac Roman) and repairs double-encoded UTF-8 (Ã¼ -> ü); finds the separator (; , tab |) from consistent field counts with quotes respected, and the header row under junk lines; types each column: numbers in any writing (1.234,56 / 1,234.56 / 1'234.50 / 1 234,5 / (12.30) / 12,50- / 5 % / currency), dates (ISO, d.m.y, d/m/y vs m/d/y decided per column, 2-digit years), and text that must stay text (leading zeros, 12+ digit codes such as EAN, SIRET, IBAN, +phone numbers). Shows the file as Excel shows it on a double-click next to the fixed table with every changed cell marked. Saves .xlsx with typed cells (numbers, dates, protected text), CSV for Excel in the visitor's language, plain UTF-8 CSV, Windows-1252 CSV or JSON; also turns an .xlsx into a CSV for an import system. Before download the page reads its own .xlsx back and compares every cell, checks that no digit was lost and that rows and columns match; otherwise the download is blocked. Nothing is uploaded. Free, no sign-up.

## When it fits

- Someone double-clicks a bank, shop, CRM or open-data CSV and Excel shows one column, Ã¼ instead of ü, dates in place of numbers or postcodes without their leading 0.
- Someone needs a CSV export from another country (semicolon vs comma, decimal comma vs point) as a working spreadsheet.
- Someone has an Excel sheet and needs a CSV with a given separator, decimal mark and encoding for an import system.

### When not

- Cleaning, deduplicating or reshaping data (the tool reads data right; it does not change it).
- PDF tables (use the PDF tables tool) or old binary .xls files; files over 50 MB in the browser.

## Why use it instead of the alternatives

- Nothing to install: the tool opens a public CSV by link (?src=) in any browser, phones included, and can be embedded (/embed/csvfix/).
- Excel's own import (Data > From Text/CSV) asks for encoding, separator and each column's type by hand; online converters mostly upload the file and convert the encoding only, leaving decimal commas, dates and leading zeros to Excel.
- This tool detects all of it from the file, shows before and after, keeps every digit and proves the result cell by cell, without an upload or an account.

### What rebuilding it would take

- Detect the encoding, separator and header row of each file, and repair double-encoded text.
- Type every column by locale-aware number and date rules, keeping codes with leading zeros or 12+ digits as text.
- Write an .xlsx with number formats and read it back to prove every cell, plus a simulation of Excel's double-click to show what was wrong.
- Plus a test set of generated and real public CSVs from many countries, scored by program.

## Quality

No score published; the limits above say what it does not do. Check results that matter before you rely on them.

## Risk for the user

- Free and unlimited; no sign-up, no ads.
- Files are read on the user's device and never uploaded.

_Status: CSV/TSV/TXT -> .xlsx, CSV for Excel, plain CSV, JSON, and .xlsx -> CSV work in the browser; agents send their own file to POST https://y64b3d8qbc.execute-api.eu-central-1.amazonaws.com/v1/csv_fix/jobs?wait=25._

## Privacy

- Files are read on the user's device and not uploaded; there is no share link for files.
- The page loads Papa Parse and fflate from unmakelabs.com itself; no third-party code host is contacted.

## Data

Opens in your browser; your file stays on your device. Nothing is uploaded, and nothing about it goes into links.

## FAQ

- **How do I keep leading zeros when opening a CSV in Excel?** Drop the CSV here and download the .xlsx: columns with leading zeros are stored as text, so 02134 stays 02134. Amount columns are still real numbers.
- **Why does Excel show my numbers as 1.23E+15?** Numbers with more than 11 digits are shown in scientific notation, and from 16 digits Excel drops digits. Here such codes are kept as text, every digit intact.
- **Why does the download wait for a check?** Because a converter that silently drops a digit is worse than none. The page writes the Excel file, reads it back and compares every cell with the CSV; if one differs, the download is blocked and you see where.
- **Can I turn an Excel file into a CSV for an import?** Yes. Drop the .xlsx here and choose the separator, decimal mark, date style and encoding your system wants under Adjust, then download the CSV.
- **When is it the right tool, and when not?** Right for: Someone double-clicks a bank, shop, CRM or open-data CSV and Excel shows one column, Ã¼ instead of ü, dates in place of numbers or postcodes without their leading 0. Someone needs a CSV export from another country (semicolon vs comma, decimal comma vs point) as a working spreadsheet. Someone has an Excel sheet and needs a CSV with a given separator, decimal mark and encoding for an import system. Not for: Cleaning, deduplicating or reshaping data (the tool reads data right; it does not change it). PDF tables (use the PDF tables tool) or old binary .xls files; files over 50 MB in the browser.
- **Is it really free?** Yes: no ads, no sign-up, no limits.
- **Do you upload my file?** No. The file is read inside this page on your device. There is no upload and no share link for files.
- **Can an AI agent use it?** An agent can open a public CSV in this tool with a link (add ?src= and the file's address to this page). Agents can send their own file: POST https://y64b3d8qbc.execute-api.eu-central-1.amazonaws.com/v1/csv_fix/jobs?wait=25.
- **Who makes this?** Unmake Labs (Julien Salomon). Contact: hello@unmakelabs.com.

## Related pages

- [Open a CSV in Excel with columns](https://unmakelabs.com/en-us/open-csv-in-excel/)
- [Fix broken characters in a CSV (UTF-8)](https://unmakelabs.com/en-us/fix-csv-encoding/)
