JSON to Excel as a real workbook, not a renamed CSV
This JSON to Excel converter writes an Office Open XML workbook (.xlsx) directly in your browser. Because the file carries cell types, Excel does not have to guess: numbers arrive as numbers you can sum, booleans as TRUE and FALSE, and text such as ZIP codes or invoice numbers stays exactly as written. That avoids the classic CSV surprises of lost leading zeros and dates invented from ordinary strings.
Example
{
"invoices": [
{ "number": "INV-0042", "customer": "Ava Martinez", "zip": "02134",
"total": 1249.5, "paid": true, "issued": "2024-06-30" },
{ "number": "INV-0043", "customer": "Noah Kim", "zip": "94105",
"total": 80, "paid": false, "issued": "2024-07-02" }
]
}
With Sheet name set to Invoices, the status bar reads Excel workbook ready (1 sheet, 8.8 KB) — click Download, and the output panel previews the sheet as CSV:
number,customer,zip,total,paid,issued
INV-0042,Ava Martinez,02134,1249.5,true,2024-06-30
INV-0043,Noah Kim,94105,80,false,2024-07-02
In the downloaded workbook, total is a numeric column, paid holds Excel booleans, and zip keeps 02134 because it was a JSON string. The invoices wrapper was unwrapped automatically, since it was the only key.
How cells are typed
| JSON value | Excel cell |
|---|---|
| Number | Numeric cell, ready for formulas |
true / false | Boolean cell (TRUE / FALSE) |
| String | Text cell, unchanged, including leading zeros |
Date-like string such as "2024-06-30" | Text cell; convert it with DATEVALUE or Text to Columns if you need a real date |
null or missing key | Empty cell |
| Nested object or array (flattening off) | Text cell with compact JSON |
The first row always contains the column names. Column widths are set from the header and the longest value in the first 200 rows, between 8 and 60 characters, so the sheet is readable the moment it opens.
Several arrays become several sheets
If the top level is an object with two or more keys and every value is an array of objects, the workbook gets one worksheet per key, named after the key. A backup-style export like {"customers": [ … ], "orders": [ … ]} therefore becomes a two-sheet file, and the Sheet name option is not used. The status bar tells you how many sheets were created.
In that case the CSV preview is only a rough view: it squeezes the whole object into one flattened row. Trust the downloaded file, or open it in the Excel viewer to check each sheet.
Options
- Sheet name – the tab name for a single-sheet workbook,
Sheet1by default. Excel allows at most 31 characters and forbids\ / ? * [ ] :, so those characters are removed and longer names are cut;Q3 / Sales: [draft]becomesQ3 Sales draft. - Flatten nested objects – on by default. Nested fields get their own columns (
customer.address.city) and array entries are numbered (items.0,items.1). Turn it off to keep one column per top-level field.
The download is named json-to-excel.xlsx; rename it after saving if you like.
Limits worth knowing
- Long numeric IDs. JSON numbers are parsed as double-precision values, and Excel itself displays at most 15 significant digits. Keep IDs such as order numbers or card-like references as strings in the JSON so they become exact text cells.
- Formulas are not evaluated. A string like
"=SUM(A1:A3)"is stored as text, not as a formula. - Very wide data. Flattening an array with hundreds of entries creates hundreds of columns. Switch flattening off, or reshape the JSON so the list becomes its own array of records.
Excel workbook or CSV file?
| .xlsx from this page | CSV | |
|---|---|---|
| Opens without an import dialog | Yes | Depends on locale and separator |
| Numbers, booleans and text kept apart | Yes, per cell | No, the reader guesses |
| Several tables in one file | Yes, one sheet per array | No |
| Readable by scripts and command-line tools | Needs a spreadsheet library | Yes |
| Easy to diff in version control | No, it is a zipped binary | Yes |
Choose the workbook when a person will open the file, and CSV when another program will read it. Need a plain text file instead? JSON to CSV gives you control over delimiter and quoting. To go back from a spreadsheet to JSON, use Excel to JSON.
Privacy
The workbook is assembled in your browser with a JavaScript spreadsheet library, so your JSON is not uploaded. Only Load URL and Save & Share involve our server.
Convert JSON to Excel in Python
Python has no built-in .xlsx writer, so use openpyxl: create a Workbook, append the keys as the header row, then append one list of values per object. Numbers, booleans and strings keep their types in the sheet. What trips people up is nested data: a cell cannot hold a list or a dictionary, and ws.append() raises ValueError: Cannot convert ['new', 'sale'] to Excel. Flatten those values or store them as JSON text, as below.
# pip install openpyxl
import json
from openpyxl import Workbook
data = """[{"sku": "A-100", "price": 24.5, "tags": ["new", "sale"]},
{"sku": "B-220", "price": 89, "tags": []}]"""
rows = json.loads(data)
wb = Workbook()
ws = wb.active
ws.title = "Products"
ws.append(list(rows[0])) # header row from the keys
for row in rows:
# a cell cannot hold a list or dict, so store those as JSON text
ws.append([json.dumps(v) if isinstance(v, (list, dict)) else v for v in row.values()])
wb.save("products.xlsx")
print(ws.dimensions, [cell.value for cell in ws[2]])
For a one-off export, the converter above builds the same kind of workbook in your browser.