CSV to JSON
Convert CSV spreadsheets to JSON with delimiter detection, data types, and header support.
Why this happens
CSV stands for "comma-separated values," but the decimal separator varies by region. For example, some locales use a comma in numbers like 12,50. As a result, Excel’s regional settings may expect CSV columns to be separated by a semicolon instead. When you open a CSV created by a system, website, or program that uses commas, Excel may not recognize the delimiter and put the entire row in one column.
The second issue—garbled characters ("João" instead of "João"), for example—is caused by encoding: the file was saved as UTF-8, but Excel read it using an older Windows encoding.
Solution 1: Import the file instead of opening it
Instead of double-clicking the file, import it into Excel. That way, you can choose the delimiter and encoding:
- Open Excel with a blank workbook.
- Go to Data › Get Data › From File › From Text/CSV (in older versions, Data › From Text).
- Select the file. In the preview window, under File Origin, choose 65001: Unicode (UTF-8) if accented characters look wrong.
- Under Delimiter, choose Comma (or whatever the file uses) and check the preview.
- Click Load.
This is the safest solution because it doesn't change the original file.
Solution 2: Text to Columns
If the file is already open and everything is in column A:
- Select column A.
- Go to Data › Text to Columns.
- Choose Delimited, click Next, and check Comma.
- In the final step, set any columns that need to keep leading zeros—such as ZIP codes or ID numbers—to Text.
- Click Finish.
This solution won't fix garbled characters. For that, use the import option.
Solution 3: Specify the delimiter in the file itself
A trick Excel recognizes: add sep=, (or sep=;) as the first line of the CSV. When you double-click to open the file, Excel uses the specified delimiter. This is useful when you create CSV files for others to open. Other programs may treat this line as data, so only use it when the file is meant for Excel.
In Google Sheets and LibreOffice
- Google Sheets: File › Import › Upload. Under Separator type, leave "Detect automatically" selected or choose Comma. Sheets reads UTF-8 correctly.
- LibreOffice Calc: When you open a CSV, an import window lets you choose the character set (UTF-8) and delimiter before opening the file.
Save CSV files the right way
- In Excel, go to Save As and choose CSV UTF-8 (Comma delimited) when the file is for a system, website, or developer. The standard "CSV (Comma delimited)" format in some regional versions of Excel may use semicolons and an older encoding.
- Ask the system you're sending the file to which delimiter it expects.
- Be careful when changing delimiters with Find and Replace: if the file contains numbers with decimal commas or text with commas, a blind replacement can scramble the columns. Find and replace can help with simple cases—just check the preview.
If you need to move data into a system or program that reads JSON, CSV to JSON automatically detects the delimiter (comma, semicolon, or tab) and preserves leading zeros as text. To convert the other way, use JSON to CSV.
Frequently asked questions
Why did the leading zero disappear from my ZIP code?
Excel treated the column as numbers and dropped the leading zero. In the import settings or Text to Columns, set that column to Text.
Numbers with commas turned into text. How do I fix them?
If the CSV uses a period as the decimal separator (12.50) and Excel is set to a locale that uses commas, values may be read incorrectly. During import, adjust the file's locale or replace the period with a comma in that column first.
Can I change Excel's default delimiter to a comma?
You can change the list separator in Windows regional settings, but this affects other programs and formulas. Importing the file is the safest solution.
What does UTF-8 mean?
It's the most widely used text encoding today and supports accented characters and characters from any language. Older Windows files use a different encoding, and mixing the two can garble accented characters.
Why do dates change format when I open a CSV?
Excel tries to convert dates based on your regional settings. Dates in the US format (month/day) may be read as day/month. Import the column as text, then convert it if needed.