Plenty of application data starts life in a spreadsheet. A product manager keeps the price list in Excel. A content team maintains store locations, FAQ entries or translation strings in a shared workbook. A client sends seed data for a new system as an .xlsx attachment. The spreadsheet is the right editing tool for these people, but the website, mobile app or API needs JSON.
This guide covers the decisions that make the difference between JSON you can use straight away and JSON you have to clean by hand: which row supplies the keys, how numbers and dates are typed, what happens to empty cells, and how to handle workbooks with several sheets. It then shows the browser method and the code equivalents in Node.js and Python.
How a sheet maps to JSON
The most common shape is an array of objects: each row becomes one object, and the header row supplies the keys.
| sku | product | price | active |
|---|---|---|---|
| P-100 | Desk lamp | 34.5 | TRUE |
| P-101 | Monitor arm | 89 | FALSE |
becomes
[
{ "sku": "P-100", "product": "Desk lamp", "price": 34.5, "active": true },
{ "sku": "P-101", "product": "Monitor arm", "price": 89, "active": false }
]
The alternative is an array of arrays, where each row is a plain list and the header is just the first list. That is more compact and keeps column order explicit, but consuming code has to know which index means what. Use it for grid-like data, such as a timetable or a matrix of values, where there is no natural header.
What a spreadsheet actually stores
The trickiest part of this conversion is that a cell has two faces: the value stored in the file and the formatted text you see on screen.
- A price displayed as
$1,250.00is stored as the number1250. - A date displayed as
14/01/2025is stored as a serial number (days since a base date in 1900), plus a date format. - A percentage shown as
12%is stored as0.12. - A formula such as
=B2*C2has a cached result, which is what an exporter reads.
For an API you almost always want the stored values: real numbers and booleans that code can compare and add up. The displayed text is useful only when the formatting itself matters, for example when a code such as a phone number must look exactly as typed.
Dates are a special case, because JSON has no date type. The usual convention is an ISO 8601 string such as "2025-01-14" or "2025-01-14T09:30:00", which sorts correctly and is parsed by every mainstream language.
Convert a workbook to JSON in your browser
The Excel to JSON Converter reads XLSX, XLSM, XLS, ODS and CSV files on your device, so client data and price lists stay private.
- Open the Excel to JSON Converter and drop your file onto the upload area, or click to browse.
- Choose the Sheet. If the workbook has more than one, All sheets (object by name) produces one JSON object whose keys are sheet names and whose values are the rows of each sheet.
- Keep First row is header on for an array of objects. Switch it off to get an array of arrays.
- Leave Keep numbers & booleans on to output real numbers and
true/false. Switch it off if you want every value as the text shown in the cell. - Turn on Include empty cells as null if every object must have every key. Otherwise blank cells are left out of their row's object.
- Pick an Indent, check the row count under the output, then click Copy or Download to save a
.jsonfile.
Dates are written as YYYY-MM-DD, with a time part added only when the cell contains one. Completely blank rows are skipped.
Doing it in code
A browser tool is ideal for a one-off conversion or for checking what a file contains. When the spreadsheet is updated every week and the JSON feeds a build or an import job, script it instead.
Node.js with SheetJS
const XLSX = require("xlsx");
const book = XLSX.readFile("customers.xlsx", { cellDates: true });
const sheet = book.Sheets[book.SheetNames[0]];
const rows = XLSX.utils.sheet_to_json(sheet, { defval: null });
console.log(JSON.stringify(rows, null, 2));
defval: null keeps empty cells as null instead of dropping the key, and cellDates: true returns JavaScript Date objects instead of serial numbers. Note that a Date serialises to a full UTC timestamp, which may shift a date by a day in some time zones, so format dates yourself if that matters.
Python with pandas
import pandas as pd
df = pd.read_excel("customers.xlsx", sheet_name=0) # needs openpyxl for .xlsx
df.to_json("customers.json", orient="records", date_format="iso", indent=2)
orient="records" gives the array-of-objects shape. Watch out for two pandas habits: empty cells become NaN, which is written as null, and an integer column that contains any blank turns into floats, so 42 may appear as 42.0 unless you convert the column first.
Excel itself
Excel has no built-in "Save as JSON". It can save as CSV, which you can then turn into JSON with CSV to JSON, but that route loses types unless the converter infers them again. The guide on turning a CSV file into JSON covers that path in detail.
Preparing the sheet so the JSON comes out clean
A few minutes of tidying in the workbook saves a lot of post-processing:
- Use short, stable header names.
unit_priceis a better key thanUnit Price (EUR, incl. VAT). Headers become keys verbatim, including spaces and capital letters. - One header row only. Merged title rows or two-row headers above the table produce odd keys. Delete them or move the table to a clean sheet.
- One kind of value per column. A quantity column that mixes
5,fiveandn/agives consumers a mix of numbers and strings. - Keep codes as text. Postcodes, SKUs and phone numbers with leading zeros should be formatted as Text in Excel, or
00123will already be stored as the number123before any conversion happens. - Remove notes from the data area. Totals rows and comments typed below the table become extra objects.
After converting, run the output through the JSON Validator if it is going into a strict system, or generate a schema with the JSON Schema Generator so future exports can be checked automatically.
Frequently asked questions
Why do my Excel dates turn into numbers like 45671?
Excel stores dates as serial day numbers and only formats them as dates on screen. A converter that reads raw values without date handling outputs that number; ours converts date cells to YYYY-MM-DD strings.
Can I convert every sheet in a workbook at once?
Yes. Choose All sheets (object by name) and the output is one JSON object with a key for each sheet, each holding that sheet's rows.
Why are some keys missing from some objects?
By default, blank cells are left out of their row's object. Turn on Include empty cells as null to give every object the same set of keys.
Are formulas converted?
The last calculated result of each formula is exported, not the formula itself. If a result looks stale, open the file in Excel, let it recalculate and save it again.
Can I convert back from JSON to Excel?
Yes, the JSON to Excel Converter builds an .xlsx workbook from an array of objects, flattening nested objects into columns.