How to Turn Spreadsheet Data Into JSON
Spreadsheets are where non-developers keep data. APIs and code want JSON. The conversion happens constantly — exporting user lists, product catalogues, event data, form submissions. Getting it right means understanding what happens to headers, types, and edge cases during the conversion.
CSV as the intermediate format
Most spreadsheet applications (Excel, Google Sheets, Numbers, LibreOffice Calc) export to CSV. CSV is the most reliable intermediate for JSON conversion — it's plain text, parseable by every language, and free of the binary format complexity of .xlsx.
Export path: File → Download → Comma Separated Values (or Save As → CSV). Each sheet exports separately — CSV is single-sheet only.
What the conversion produces
A CSV-to-JSON converter treats the first row as field names and each subsequent row as an object:
name,age,city,active
Alice,30,Berlin,true
Bob,25,Munich,false
Carol,35,Hamburg,true
Becomes:
[
{"name": "Alice", "age": "30", "city": "Berlin", "active": "true"},
{"name": "Bob", "age": "25", "city": "Munich", "active": "false"},
{"name": "Carol", "age": "35", "city": "Hamburg", "active": "true"}
]
Type handling: the critical issue
CSV has no types — every cell is a string. The converter produced "age": "30" (string), not "age": 30 (number). Whether this matters depends on what the JSON is used for:
- Feeding to an API with a typed schema → numbers must be numbers, booleans must be booleans
- Loading into a typed database → types must match the column types
- Displaying in a UI → strings are usually fine
Type inference — attempting to detect numbers, booleans, and dates automatically — helps but has edge cases. A product SKU like 007832 looks like a number but is a string; inferring it as 7832 strips the leading zeros and breaks product lookups.
Column header issues
Column headers with spaces become string keys: "first name". These are valid JSON keys but require bracket notation in JavaScript (record["first name"] not record.first name) and may cause issues in some downstream tools. Clean headers to use underscores or camelCase before converting if the target system expects specific key formats.
Empty cells and missing data
Empty cells become empty strings ("") in most converters, not null. If your downstream system distinguishes between a missing value and an empty string, you'll need post-processing to convert empty strings to null for the relevant fields.
Frequently Asked Questions
How do I convert a CSV file to JSON? Upload your CSV to a CSV to JSON converter. The tool reads the first row as field names and converts each subsequent row into a JSON object. The output is a JSON array where each element represents one spreadsheet row.
How do I convert Excel data to JSON? Export the Excel sheet as a CSV file first (File > Save As > CSV), then use a CSV to JSON converter. Alternatively, some tools accept Excel files directly and handle the conversion internally.
How do I export Google Sheets data as JSON? Download the sheet as a CSV (File > Download > Comma-separated values), then convert the CSV to JSON with an online converter. For automated workflows, the Google Sheets API returns data in JSON format directly.
What is the output format when converting CSV to JSON? The default output is an array of objects, where each object represents one row and uses the column headers as keys. For example, a row with Name and Age columns becomes {"Name": "Alice", "Age": "30"}.
Why are all my numbers coming out as strings after CSV to JSON conversion? CSV has no type information — every cell is a string. The converter does not know whether "30" should be a number or a string. Some converters detect and convert numeric values automatically. If yours does not, post-process the JSON to cast numeric fields to the correct type.
How do I handle empty cells when converting spreadsheet data to JSON? Empty cells should become null in JSON to distinguish a missing value from an empty string. Check whether your converter uses null, empty strings, or omits the key entirely for empty cells, and normalise to null if needed for downstream consumers.
Can I convert JSON back to a spreadsheet? Yes. A JSON to CSV converter flattens a JSON array of objects into CSV rows. This is useful for exporting API response data, processed records, or any JSON dataset into Excel or Google Sheets for review or reporting.
What should I do with date columns when converting to JSON? Spreadsheet date values are often stored as locale-specific strings or serial numbers. Convert them to ISO 8601 format (YYYY-MM-DD) in JSON so downstream applications can parse them reliably regardless of locale or tool.