DataSwitch Pro Private, in-browser data converter

How to Convert Excel to JSON: 3 Methods (No Code, Python, Power Query)

By the DataSwitch Pro team · · 5 min read

Quick answer

To convert Excel to JSON, make sure the first row of the sheet holds the column names, then turn every following row into one JSON object whose keys are those names. You can do it without code in an online converter such as Excel to JSON, with Python (pandas.read_excel(...).to_json(orient="records")), or by exporting a CSV and converting that. Check dates, empty cells and long ID numbers afterwards — they are the values that most often change.

JSON is the format web apps, APIs and JavaScript code expect, while the data often lives in a spreadsheet: a product list, a price table, translations, a list of stores. Converting one into the other is simple once you know what the result should look like and which values need care.

What the JSON should look like

The standard result is an array of objects: one object per row, with the header row providing the keys.

Excel sheet

sku    | name          | price | in_stock
A-100  | Ceramic mug   | 12.5  | TRUE
A-101  | Glass jar     | 8.9   | FALSE

JSON (array of objects)

[
  { "sku": "A-100", "name": "Ceramic mug", "price": 12.5, "in_stock": true },
  { "sku": "A-101", "name": "Glass jar", "price": 8.9, "in_stock": false }
]

Before converting, tidy the sheet: one header row, no merged cells, no blank rows in the middle, and short header names without line breaks. Header names become keys in code, so price_eur is easier to work with than Price (EUR) incl. VAT.

Method 1: Convert in the browser (no code)

  1. Open the Excel to JSON converter and drop your .xlsx file on it.
  2. If the workbook has several sheets, choose the sheet from the selector.
  3. Decide whether numbers and true/false values should be typed (Detect numbers & booleans) or kept as text.
  4. Copy the JSON or download it as a .json file.

The file is read by JavaScript in your browser tab and is not uploaded, which matters when the sheet contains customer or financial data.

Method 2: Python and pandas

For repeatable conversions, a few lines of Python do the job. Install pandas and openpyxl first (pip install pandas openpyxl).

Python

import pandas as pd

df = pd.read_excel("products.xlsx", sheet_name="Sheet1", dtype={"sku": str})
df.to_json("products.json", orient="records", indent=2,
           force_ascii=False, date_format="iso")

orient="records" produces the array of objects shown above, force_ascii=False keeps accented and Arabic characters readable instead of escaping them, and dtype={"sku": str} stops pandas from turning codes like 00412 into the number 412. To convert every sheet, pass sheet_name=None: you get a dictionary of DataFrames, one per sheet, that you can write to separate files.

Method 3: Excel itself, via CSV

Excel has no built-in “Save as JSON”. The usual workaround is File → Save As → CSV UTF-8, then converting the CSV with a CSV to JSON converter or a script. It works, but CSV loses the cell types, so every value starts as text and has to be re-typed during the conversion. Converting the .xlsx directly keeps numbers, booleans and dates as Excel stored them.

Values that need attention

Nested JSON from a flat sheet

Sometimes the target needs nested objects, such as {"address": {"city": "Fes"}}. Spreadsheets are flat, so the common convention is to name columns with dots — address.city, address.zip — and rebuild the nesting in code. In Python, a small loop that splits each key on . is enough. If the nesting is deep or contains lists, consider keeping the data in JSON from the start instead of a spreadsheet.

Checking the result

Paste the output into a JSON formatter to confirm it is valid and readable, and spot-check a few rows: the first, the last, and any row with empty cells or special characters. If the JSON will go back into Excel later, the reverse JSON to Excel conversion should give you the same table.

Try it on your own file. Free, private, and processed in your browser.

Frequently asked questions

Can Excel save a file as JSON directly?

No. Excel saves to formats such as .xlsx, CSV and XML, but not JSON. Use a converter, a script, or export CSV and convert that.

How do I convert only one sheet of a workbook?

Choose the sheet in the converter's sheet selector, or pass sheet_name="Sheet1" to pandas.read_excel.

Why do my dates appear as numbers in the JSON?

The cells contain Excel serial numbers formatted as numbers rather than dates. Format the column as Date in Excel, or convert the serial number in code: day 1 is 1 January 1900.

Is it safe to convert confidential spreadsheets online?

Only if the tool processes the file locally. A browser-based converter that does not upload the file keeps the data on your computer.

More guides