How to convert JSON to Excel
Updated · 3 min read
API responses, database exports and log files usually arrive as JSON, but the people who need to read them often live in Excel. This tool converts a JSON array into an .xlsx file: every object becomes a row, every key becomes a column, and nested objects are spread into their own columns so nothing is hidden inside a cell.
- Paste your JSON, or drop a
.jsonfile onto the input box. - Check the preview on the right — it shows the rows and columns the workbook will contain.
- Leave Flatten nested JSON to columns on to split nested objects into separate columns.
- Click Download to save the
.xlsxfile, or Copy and paste straight into Excel or Google Sheets.
Example
JSON input
[
{ "order": 1001, "customer": { "name": "Leila", "city": "Fes" }, "total": 149.5, "paid": true },
{ "order": 1002, "customer": { "name": "Tom", "city": "Lyon" }, "total": 80, "paid": false, "coupon": "WELCOME" }
]Excel output
| order | customer | total | paid | coupon |
|---|---|---|---|---|
| 1001 | {"name":"Leila","city":"Fes"} | 149.5 | TRUE | |
| 1002 | {"name":"Tom","city":"Lyon"} | 80 | FALSE | WELCOME |
The nested customer object becomes two columns, customer.name and customer.city. The second order has a coupon that the first one lacks, so the column is added and the first row's cell is simply left empty.
Your data stays on your device. The conversion runs in JavaScript inside this tab — files and pasted text are never uploaded to DataSwitch Pro.
What the Excel file looks like
- A single worksheet named Data with your keys as a bold header row that stays frozen while you scroll.
- Column widths sized to the content, up to a sensible maximum.
- Typed cells: numbers are real numbers (so
SUMand charts work), booleans are TRUE/FALSE, and text stays text. - Strings that start with
=are stored as text, never as formulas, so untrusted JSON cannot inject spreadsheet formulas.
Nested objects and arrays
With flattening enabled, {"customer":{"address":{"city":"Fes"}}} becomes a column called customer.address.city. Arrays such as "tags":["new","sale"] are written into one cell as JSON text (["new","sale"]), which keeps every value without creating dozens of sparse columns. Turn flattening off to keep each nested object as JSON text in a single cell.
Which JSON shapes work
- An array of objects — the usual case; one row per object.
- A wrapper object such as
{"results": [ … ]}, typical of API responses — the inner array is used automatically. - A single object — exported as one row.
- An array of plain values — exported as a single column named
value.
Excel limits to keep in mind
An Excel worksheet holds at most 1,048,576 rows and 16,384 columns, and a single cell can contain up to 32,767 characters. Larger datasets are better kept as CSV or loaded into a database — the JSON to CSV and JSON to SQL converters handle those cases.
Convert JSON to Excel in code
For one-off files the tool above is quickest. To automate the same task in a script or pipeline, these snippets are a good starting point.
Python (pandas)
import json
import pandas as pd # pip install pandas openpyxl
with open("data.json", encoding="utf-8") as f:
data = json.load(f)
pd.json_normalize(data).to_excel("data.xlsx", index=False)
Node.js (write-excel-file)
// npm install write-excel-file
import writeXlsxFile from "write-excel-file/node";
import { readFileSync } from "node:fs";
const data = JSON.parse(readFileSync("data.json", "utf8"));
const header = Object.keys(data[0]);
const rows = data.map(o => header.map(k => o[k] ?? null));
await writeXlsxFile([header, ...rows]).toFile("data.xlsx");
Frequently asked questions
Can I open the result in Google Sheets or LibreOffice?
Yes. The .xlsx format is supported by Google Sheets (File → Import), LibreOffice Calc, Apple Numbers and every recent version of Excel.
Will numbers be stored as numbers?
Yes. JSON numbers become numeric cells and JSON booleans become TRUE/FALSE, so formulas, sorting and charts work immediately. JSON strings remain text even if they look like numbers, which protects codes with leading zeros.
Can I create several sheets at once?
The converter creates one sheet per file. To build a multi-sheet workbook, convert each JSON array separately and move the sheets into one workbook in Excel.
Why does a cell contain text in square brackets?
That cell came from a JSON array. Arrays are written as JSON text so no values are lost; split them in Excel with Text to Columns if you need separate cells.
Is my JSON uploaded to a server?
No. The workbook is generated by JavaScript in your browser and saved directly to your device.