<!-- How to Convert Excel to JSON (3 Ways) | DataSwitch Pro -->
<!-- Canonical: https://dataswitchpro.com/guides/convert-excel-to-json/ -->
> Convert an Excel sheet to a JSON array: in the browser, with Python and pandas, or via CSV. Plus how to handle dates, empty cells and long IDs.

[Home](https://dataswitchpro.com/) › [Guides](https://dataswitchpro.com/guides/)

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

By the DataSwitch Pro team · November 20, 2026 · 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](https://dataswitchpro.com/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](https://dataswitchpro.com/excel-to-json/) 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](https://dataswitchpro.com/csv-to-json/) 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

- **Dates.** Excel stores a date as a serial number (for example, 45000 is 15 March 2023) and only displays it as a date. A good converter turns real date cells into ISO text such as `"2023-03-15"`. If you see five-digit numbers instead, the column was formatted as a number, not a date.
- **Empty cells.** Decide whether an empty cell should become `""`, `null` or be left out. APIs often treat these differently, so match what the receiving code expects.
- **IDs and leading zeros.** A phone number or postcode stored as a number has already lost its leading zero inside Excel. Format such columns as Text before typing the data, or keep them as strings during conversion.
- **Large numbers.** JavaScript loses precision above 9,007,199,254,740,991. Keep long IDs as strings so they survive `JSON.parse`.
- **Formulas.** Only the last calculated value is exported, not the formula itself.

## 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](https://dataswitchpro.com/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](https://dataswitchpro.com/json-to-excel/) conversion should give you the same table.

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

[Excel to JSON](https://dataswitchpro.com/excel-to-json/)[JSON to Excel](https://dataswitchpro.com/json-to-excel/)[CSV to JSON](https://dataswitchpro.com/csv-to-json/)[JSON Formatter](https://dataswitchpro.com/json-formatter/)

## 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

- [How to Open and Import a JSON File in Excel (Power Query, API URL or Converter)](https://dataswitchpro.com/guides/open-json-file-in-excel/)
- [How to Convert CSV to JSON: Types, Empty Cells and Nested Keys](https://dataswitchpro.com/guides/convert-csv-to-json/)
- [How to Flatten Nested JSON into a CSV Table](https://dataswitchpro.com/guides/flatten-nested-json-to-csv/)
- [Why Your CSV Opens in One Column in Excel (and How to Fix It)](https://dataswitchpro.com/guides/csv-opens-in-one-column-excel/)
