Excel to JSON: How to Convert Spreadsheet Data for APIs and Developers
Spreadsheets are the default format for anyone entering data by hand, but most APIs, web apps, and databases expect JSON. That mismatch shows up constantly, a product catalog maintained in Excel that needs to feed a web store, a client list that needs to POST into a CRM's API, or configuration data that a developer needs in a structured, nested format instead of flat rows and columns. Here's how the conversion actually works, and where it gets more complicated than a simple row-to-object mapping.
The basic mapping
At its simplest, each row in a spreadsheet becomes one JSON object, and each column header becomes a key:
name, price, in_stock
Widget A, 12.99, true
becomes:
[
{ "name": "Widget A", "price": 12.99, "in_stock": true }
]
This works cleanly when your spreadsheet is already "one row = one record" with consistent columns. Most real-world spreadsheets aren't quite that tidy.
Where it gets harder: types
A spreadsheet cell doesn't carry a data type the way JSON requires, "12.99" needs to become a number, not a string; "true"/"FALSE"/"Yes" all need to resolve to a real boolean; empty cells need to become either `null` or be omitted, consistently. Getting this wrong is the most common source of downstream bugs, an API that expects `"price": 12.99` as a number will often reject or silently mishandle `"price": "12.99"` as a string.
A limitation worth knowing: this is a flat conversion
Real data is sometimes hierarchical even when the spreadsheet is flat, prefixed columns like `address_street`, `address_city`, and `address_zip` conceptually belong together under one `address` object. Datafromfile's JSON export produces one flat object per row (each column becomes one top-level key), it does not automatically nest related columns into sub-objects. For most API integrations and database imports this flat shape is exactly what's expected, but if your target genuinely requires nested objects, plan on a small post-export transformation step rather than expecting the export itself to infer the hierarchy.
Converting with Datafromfile
The Excel, CSV & JSON extractor handles the row/column parsing directly, upload an XLSX or CSV file, and it parses the structure deterministically (no AI model needed for already-structured formats like these), giving you an editable table you can fix, renamed headers, corrected values, removed junk rows, before exporting to clean, flat JSON.
Going the other direction: JSON to Excel
The same tool works in reverse, upload a JSON file and it flattens nested objects into spreadsheet columns, which is often what you need when handing API data to someone who works in Excel rather than code. See our guide on extracting JSON data and converting it to Excel or CSV for that direction specifically.
A quick pre-conversion checklist
- Confirm every row actually represents one record, merged header rows or subtotal rows will corrupt a straightforward conversion.
- Decide how you want empty cells handled (omitted vs. `null`) before exporting, since this affects how downstream code needs to check for missing values.
- If nesting is required, use consistent column-name prefixes so the structure is unambiguous.
Try converting a spreadsheet, free, no credit card required, and you'll see the parsed structure before committing to an export format.