How to Convert Excel to JSON: 5 Easy Methods That Actually Work

How to convert Excel to JSON data shown on a server monitor transformation display.

To convert Excel to JSON, upload your .xlsx or .xls file to a browser-based Excel to JSON converter, let it read the first row as column headers, then copy or download the JSON file. Each spreadsheet row becomes one JSON object, and each column header becomes a key. For repeat jobs, use Python pandas or JavaScript SheetJS.

Introduction

I work with spreadsheets almost every day, and sooner or later someone always asks me the same thing: “Can you turn this Excel sheet into JSON so the developer can use it?” A product list for a website, a price sheet for an app, a contact list for an API import. The data lives in Excel, but the system that needs it only speaks JSON.

The first time I tried to convert Excel to JSON, I copied cells into a text editor and typed brackets by hand. It took an hour, and one missing comma broke the whole file. Since then I have tested every practical route, from one-click online tools to Python scripts, and I have learned which one fits which job.

In this guide I will show you five methods to convert Excel to JSON, explain how headers, arrays and nested objects work, and walk through the problems nobody warns you about: dates turning into strange numbers, ZIP codes losing their leading zeros, and empty cells breaking your app. If you just want the result right now, the free Excel to JSON converter on X2X Converter does it in your browser in a few seconds.

What Is JSON and Why Convert Excel to JSON?

JSON (JavaScript Object Notation) is a lightweight, text-based format for storing and exchanging structured data. It is the standard language of web APIs, JavaScript apps, NoSQL databases and most modern software. Excel is built for people to read and calculate; JSON is built for programs to read and move data.

Here are the core JSON terms you will see throughout this guide:

  • JSON object: a set of key-value pairs inside curly brackets, for example {“name”: “Ali”, “city”: “Lahore”}.
  • Key-value pairs: each key is a text label in double quotes, followed by a colon and a value.
  • JSON array: an ordered list of values inside square brackets, for example [1, 2, 3].
  • Array of objects: a list where every item is an object. This is the most common shape when you convert Excel to JSON, because each row becomes one object.
  • Nested JSON: an object or array placed inside another object, such as an address object inside a customer object.

If your JSON comes out as one long unreadable line, paste it into the JSON prettifier to format it with clean indentation before you share it.

People usually need to convert Excel to JSON for a few reasons: importing products or users into a web app, seeding a database, feeding data to an API, building a static website, or preparing data for an AI or automation tool. If you are a developer who hates writing one-off scripts for this, I covered the wider no-code workflow in my guide to data conversion without writing scripts.

How Excel Rows Become JSON Objects

Before you pick a method to convert Excel to JSON, it helps to see exactly what happens to your spreadsheet data. A converter reads your tabular data in a simple pattern: the first row holds the column headers, and every row under it becomes one record.

Take this small sheet:

idnamecityprice 
1Laptop StandLahore2500
2USB HubKarachi1800

When you convert Excel to JSON with headers, you get an array of objects:

[
  { “id”: 1, “name”: “Laptop Stand”, “city”: “Lahore”, “price”: 2500 },
  { “id”: 2, “name”: “USB Hub”, “city”: “Karachi”, “price”: 1800 }
]

Notice three things. The column headers became keys. Each row became one object. And the whole sheet sits inside one JSON array. That “column headers as keys, rows to objects” pattern is what most people want, and every method below produces it.

Method 1: Convert Excel to JSON Online (Fastest, No Code)

An online converter is the quickest way to convert Excel to JSON when you have a one-off file and no time to set anything up. This is the method I reach for first.

Here is how I convert Excel to JSON with the X2X Converter tool:

  1. Open the Excel to JSON tool in any modern browser.
  2. Click the upload area or drag your .xlsx or .xls file onto it.
  3. The tool reads the sheet, uses the first row as keys, and shows the JSON output.
  4. Click Copy JSON to paste it straight into your code, or Download JSON to save a .json file.

That is it. No sign-up, no installation and no fee.

Why I like this route: it is free, it works on Windows, Mac, Linux and even a phone, and it suits people who just need clean output fast. X2X Converter states that its conversions run locally in your browser, so the file is processed on your own device rather than stored on a server.

When it is not enough: if you need to convert Excel to JSON every day, run it on hundreds of files, or apply custom rules (rename keys, change data types, build deep nesting), a script will save you time in the long run. That is where methods 3 and 4 come in.

Method 2: Convert Excel to JSON Inside Excel With Office Scripts

A lot of people ask me whether they can convert Excel to JSON with Excel itself. The honest answer is no. Excel’s Save As list includes formats like .xlsx, .csv, .xml, .txt and .pdf, but there is no JSON option. Power Query can import JSON into Excel, but it does not export it.

The Microsoft-supported way to convert Excel to JSON without leaving Excel is Office Scripts, the TypeScript automation feature on the Automate tab.

  1. Select your data and press Ctrl + T to format it as an Excel table with a header row.
  2. Go to Automate > New Script.
  3. Paste a script that reads the table’s header row, loops through each data row and builds one object per row.
  4. Click Run. The JSON appears in the output pane, ready to copy.

Microsoft publishes an official “Output Excel data as JSON” sample you can paste in and adapt.

Things to know before you try it:

  • Office Scripts needs a business or education Microsoft 365 plan with OneDrive for Business. Home and personal plans are not on Microsoft’s supported list.
  • It works in Excel on the web, Excel for Windows (version 2210 or later) and Excel for Mac.
  • Microsoft’s sample reads cell text, so numbers come out as strings, for example “10” instead of 10. You can switch to reading values if you need real numbers.
  • The sample handles one table on one sheet. Multiple sheets need extra code.
  • You can connect the script to Power Automate if you want to convert Excel to JSON on a schedule.

I recommend this route for office teams already on Microsoft 365 who want to convert Excel to JSON automatically without installing anything.

Method 3: Convert Excel to JSON With Python (pandas)

Python is my favorite way to convert Excel to JSON for large files and repeatable jobs. The pandas library reads Excel files and writes JSON in two lines of code. Install it first with pip install pandas openpyxl, then run:

import pandas as pd

df = pd.read_excel(“products.xlsx”, sheet_name=0)
df.to_json(“products.json”, orient=”records”, indent=2,
          force_ascii=False, date_format=”iso”)

Here is what each setting does, and why I always set them:

  • orient=”records” gives you an array of objects, one per row. This matters because the pandas default for a table is “columns”, which groups values by column and confuses most people the first time.
  • indent=2 makes the file readable.
  • force_ascii=False keeps Urdu, Arabic and accented characters readable instead of turning them into \u codes.
  • date_format=”iso” writes dates like 2026-11-02T00:00:00.000. The older default wrote milliseconds since 1970, and pandas has deprecated it.

The pandas read_excel documentation lists every option, including usecols to pick columns, skiprows when your headers are not in row 1, and dtype to control data types. One tip from experience: old .xls files need an extra reader library (xlrd or calamine), while .xlsx files use openpyxl.

Convert all sheets at once: pass sheet_name=None. pandas then returns a dictionary of tables keyed by sheet name, and you can write each one to its own file or combine them into one JSON object.

Method 4: Convert Excel to JSON in JavaScript (SheetJS)

If you are building a web app or a Node.js script, SheetJS is the library most developers use to read spreadsheets in JavaScript. Its sheet_to_json function does the heavy lifting.

const XLSX = require(“xlsx”);
const fs = require(“fs”);

const workbook = XLSX.readFile(“products.xlsx”);
const output = {};

for (const name of workbook.SheetNames) {
  output[name] = XLSX.utils.sheet_to_json(workbook.Sheets[name], { defval: null });
}

fs.writeFileSync(“products.json”, JSON.stringify(output, null, 2));

A few details that save me debugging time when I convert Excel to JSON in Node:

  • By default, sheet_to_json uses the first row as keys and returns an array of objects.
  • Empty cells are skipped by default, so some objects end up missing keys. Setting defval: null keeps every key in every object.
  • If two columns have the same header, SheetJS renames them name, name_1, name_2 so no data is lost.
  • header: 1 returns plain arrays instead of objects, which helps when your sheet has no header row.

This method is ideal for developers who want to convert Excel to JSON inside their own product, either on a server or directly in the browser.

Method 5: Convert Excel to JSON With Google Sheets and Apps Script

Not everyone has Excel installed, but you can still convert Excel to JSON for free. I do a lot of my own work in Google Sheets, and it handles this job well.

  1. Upload your .xlsx file to Google Drive and open it with Google Sheets.
  2. Go to Extensions > Apps Script.
  3. Paste a short script that reads the data range, takes the first row as headers and maps each row to an object.
  4. Run it and copy the JSON from the execution log.

function sheetToJson() {
  const [headers, …rows] = SpreadsheetApp.getActiveSheet().getDataRange().getValues();
  const data = rows.map(r => Object.fromEntries(headers.map((h, i) => [h, r[i]])));
  Logger.log(JSON.stringify(data, null, 2));
}

This is a good free option if your team already lives in Google Workspace.

Which Method Should You Use?

MethodBest forCoding neededMultiple sheetsCost 
Online converterOne-off files, quick resultsNoneDepends on toolFree
Office ScriptsMicrosoft 365 business teamsA little TypeScriptNeeds extra codeIncluded in business plans
Python pandasLarge files, repeat jobs, data teamsBasic PythonYesFree
JavaScript SheetJSWeb apps and Node.js projectsJavaScriptYesFree
Google Apps ScriptGoogle Sheets users without ExcelA little JavaScriptYes, with a loopFree

My rule of thumb: if you need to convert Excel to JSON once, use the online tool. If you need it every week, write the script once and reuse it.

How to Convert Excel to JSON With Headers the Right Way

Headers decide your keys, so a messy header row means messy JSON when you convert Excel to JSON. Before I convert Excel to JSON with headers, I clean the first row using this checklist:

  • Keep headers unique. The JSON standard says names inside an object should be unique, and many parsers silently keep only the last value when a name repeats. Two columns both called “Phone” can quietly erase half your data.
  • Fill every header. Blank headers turn into odd keys like __EMPTY or Unnamed: 3, depending on the tool.
  • Use simple key names. Spaces are legal in JSON keys, but first_name or firstName is far easier for developers than First Name (as on ID).
  • Put headers in row 1. If your sheet has a title or a logo above the table, delete those rows or tell your tool to skip them.
  • Unmerge header cells. Merged cells usually leave blanks behind, which create missing or empty keys.

Array of Objects vs Other JSON Shapes

When you convert Excel to JSON array of objects, you get the format almost every API and JavaScript app expects. But it is not the only shape. Knowing the options helps when a developer asks for something specific.

  • Array of objects (records): [{“id”:1,”name”:”A”}, {“id”:2,”name”:”B”}]. Best for APIs and most apps.
  • Object keyed by ID: {“1”: {“name”:”A”}, “2”: {“name”:”B”}}. Handy for fast lookups, but every ID must be unique, or rows will overwrite each other.
  • Array of arrays: [[“id”,”name”],[1,”A”],[2,”B”]]. Compact, but the keys are lost.
  • Columns: {“name”: {“0″:”A”,”1″:”B”}}. This is the pandas default, and the one that surprises people.

If you are unsure how to structure the output when you convert Excel to JSON, choose array of objects. It is the safest and most widely supported JSON format.

How to Convert Excel to Nested JSON

This is the question I get most from developers, and most guides skip it. Excel is flat. Every cell sits in a row and a column. JSON can be nested, with objects inside objects. So how do you convert Excel to nested JSON? Here are the three ways I convert Excel to JSON with nesting.

Option 1: Use dot-notation headers. Name your columns like address.city and address.zip. Many converters and libraries can then build this:

{ “name”: “Ali”, “address”: { “city”: “Lahore”, “zip”: “54000” } }

A basic converter will output the literal key “address.city” instead, so check your result. In Python, you can split the header on the dot and build the inner object with a few lines of code.

Option 2: Group rows by an ID. For one-to-many data, such as one order with several items, put one item per row and repeat the order ID. Then group the rows in code so each order holds an items array.

Option 3: Use one sheet per level. Keep customers on one sheet and orders on another, linked by a customer ID. Read both sheets and join them in code. This is how I handle anything more than two levels deep, because it keeps the spreadsheet easy for non-technical people to edit.

Converting Multiple Sheets to JSON

When you convert Excel to JSON from a workbook with several tabs, it usually becomes one JSON object keyed by sheet name:

{
  “Products”: [ { “id”: 1, “name”: “Laptop Stand” } ],
  “Suppliers”: [ { “id”: 7, “name”: “Lahore Traders” } ]
}

The other option is one .json file per sheet. pandas (sheet_name=None), SheetJS (workbook.SheetNames) and Apps Script all support this. Many quick online tools only read the first sheet, so check your output if your workbook has several tabs.

Fixing Dates When You Convert Excel to JSON

If you have ever seen a date like 45597 appear in your JSON, you have met Excel’s serial number system. Excel stores every date as the number of days since a starting point. In the default 1900 system, July 5, 2011 is stored as 40729. Older Mac workbooks may use the 1904 system, where the same date is 39267, and Microsoft’s guide to date systems in Excel explains that the gap between the two is exactly 1,462 days.

Here is how I avoid date problems:

  • Ask your tool or script to output ISO 8601 text such as 2026-11-02. Every programming language can read it.
  • In pandas, set date_format=”iso”.
  • If you only receive serial numbers, convert them in code using the correct base date.
  • If the workbook came from an old Mac, check whether it uses the 1904 system before you trust any date.

Leading Zeros, Long Numbers and Data Types

Excel removes leading zeros by default, so a ZIP code like 05401 turns into 5401, and phone numbers or product codes lose their first digit. Excel also keeps only 15 digits of precision, according to the official Excel specifications and limits page, so a 16-digit card or account number gets its last digit replaced with zero.

My fixes before I convert Excel to JSON:

  • Format ID, phone, ZIP and account columns as Text before you type or paste the data.
  • In pandas, read those columns as text with dtype={“zip”: str}.
  • Keep IDs as strings in JSON. You will never do math on a phone number.

Also watch for numbers stored as text (green triangles in Excel), currency symbols like “$1,200” turning into strings, and TRUE/FALSE or Yes/No columns that should become JSON true and false.

Handling Empty Cells

When you convert Excel to JSON, empty cells can show up three ways:

  • The key is missing: {“name”: “Ali”}
  • The key is null: {“name”: “Ali”, “email”: null}
  • The key is an empty string: {“name”: “Ali”, “email”: “”}

Pick one and stay consistent, because apps check for these differently. I prefer null, since it keeps every object the same shape. One surprise with pandas: by default it treats text like NA, NULL and None as missing values. If “NA” is a real value in your data, such as the country code for Namibia, turn that behavior off with keep_default_na=False.

How to Check Your JSON Output

Every time I convert Excel to JSON, I test the file before I send it to a developer. Valid JSON follows strict rules:

  • Keys and text values must use double quotes, never single quotes.
  • No trailing comma after the last item.
  • true, false and null must be lowercase.
  • NaN and Infinity are not allowed.

A quick test is to paste the output into your browser console and run JSON.parse() on it. The MDN JSON.parse reference explains that it throws a SyntaxError for invalid JSON, including trailing commas and single quotes. For the full rules, the official JSON standard, RFC 8259 is short and surprisingly readable.

Is It Safe to Convert Excel to JSON Online?

It depends on how the tool works. Some converters upload your file to their server. Others process everything inside your browser, so the data never leaves your computer. If you convert Excel to JSON for client lists, salary sheets or anything personal, choose a tool that runs locally, or use Python on your own machine.

I explained the difference between server-side and client-side tools in detail in this guide on why browser-based file conversion is the safer choice.

Common Mistakes When You Convert Excel to JSON

These are the mistakes I see most often, including ones I made myself:

  1. Converting the wrong sheet. Most tools read the first tab by default.
  2. Leaving a title row above the headers. Your keys become “Product List 2026” and blanks.
  3. Duplicate column names. One column silently overwrites the other.
  4. Forgetting date formatting. You get serial numbers instead of dates.
  5. Losing leading zeros. ZIP codes and IDs break.
  6. Hidden rows and columns. They are still in the file and still get converted.
  7. Formulas without saved values. Some libraries read the formula text instead of the result.
  8. Not validating the output. A single stray comma can break a whole import.

Other Conversions You May Need

Data rarely arrives in just one format. If you receive an XML export from an older system, you can turn it into the same JSON structure with the XML to JSON converter and keep your whole pipeline in one format.

Key Takeaways

  • To convert Excel to JSON, the first row becomes keys and each row becomes one JSON object inside an array.
  • Excel has no built-in JSON export. Use an online tool, Office Scripts, Python, JavaScript or Google Apps Script.
  • An online converter is fastest for one-off files; scripts are best for repeat jobs and custom structures.
  • Clean your headers before you convert Excel to JSON: unique, filled, simple and in row 1.
  • Output dates as ISO 8601 text, and format IDs and ZIP codes as text to keep leading zeros.
  • Build nested JSON with dot-notation headers, grouped rows or one sheet per level.
  • Always validate your JSON before you share it.

Frequently Asked Questions

How do I convert Excel to JSON for free?

Upload your .xlsx or .xls file to a free browser-based Excel to JSON converter, check the output, then copy it or download the .json file. You can also use free code options such as Python pandas, JavaScript SheetJS or Google Apps Script if you prefer to run the conversion on your own machine.

Can Excel export JSON directly?

No. Excel has no Save As JSON option. Power Query can import JSON but not export it. Inside Excel, the supported route is Office Scripts, which needs a business or education Microsoft 365 plan. For everyone else, an online converter or a short Python script is the easiest way to convert Excel to JSON.

How do I convert Excel to JSON without code?

The easiest way to convert Excel to JSON without code is an online converter. Upload the file, let the tool read the first row as headers, and download the result. No installation, sign-up or programming is needed. Clean your header row first so the JSON keys come out tidy.

How are Excel headers turned into JSON keys?

The converter reads the first row of the sheet and uses each cell as a key name. Every row below becomes one JSON object, where each value sits under its column’s key. That is why unique, non-empty headers in row 1 are so important.

What is the difference between a JSON array and a JSON object?

A JSON object is a set of key-value pairs inside curly brackets, like one spreadsheet row. A JSON array is an ordered list inside square brackets. When you convert a sheet, you usually get an array of objects: one list holding one object per row.

How do I convert an Excel file with multiple sheets to JSON?

Use a tool or script that reads every tab. In Python, pass sheet_name=None to read_excel. In JavaScript, loop over workbook.SheetNames with SheetJS. The usual output is one JSON object keyed by sheet name, or one separate JSON file for each sheet.

Why do my Excel dates show as numbers in JSON?

Excel stores dates as serial numbers counting days from a base date, usually January 1, 1900. Some converters output that raw number. Set your tool or script to output ISO 8601 text such as 2026-11-02, or convert the serial number in code using the correct date system.

How do I keep leading zeros when converting Excel to JSON?

Format ZIP code, phone and ID columns as Text in Excel before entering the data, because Excel removes leading zeros from numbers. In pandas, read those columns as strings using the dtype option. Then the JSON keeps values like “05401” exactly as written.

Can I convert Excel to nested JSON?

Yes. Use dot-notation headers such as address.city, group related rows by a shared ID, or keep each level on its own sheet and join them in code. Simple online tools usually produce flat JSON, so complex nesting is easier with Python or JavaScript.

Is it safe to convert Excel to JSON online?

It is safe when the tool processes the file inside your browser instead of uploading it to a server. Check the tool’s privacy statement before uploading sensitive data. For confidential files, a browser-based converter or a local Python script keeps the data on your own device.

Conclusion

Learning how to convert Excel to JSON saves hours of copy-pasting and prevents the small errors that break imports. Pick the method that matches the job: a browser tool for quick one-off files, Office Scripts for Microsoft 365 teams, and Python or JavaScript for large, repeatable or nested conversions. Whatever route you take, clean the header row, fix dates and leading zeros, and validate the output before you hand it over.

When you are ready to convert Excel to JSON right now, open the free X2X Converter tool, drop in your spreadsheet and download clean JSON in seconds. No sign-up and no software to install.