How to Convert Excel to JSON: A Complete Guide

Published on June 18, 2026 · 8 min read

Excel spreadsheets are everywhere — from financial reports and inventory lists to customer databases and scientific datasets. But when it comes to web applications, APIs, and modern data workflows, JSON (JavaScript Object Notation) is the lingua franca. Converting Excel to JSON bridges the gap between traditional spreadsheet workflows and modern software systems.

In this guide, we'll walk through why you'd want to convert Excel to JSON, explore manual and automated methods, provide working code examples in JavaScript and Python, and introduce the fastest way to do it — right in your browser with ConvertMatrix's Excel to JSON converter.

Why Convert Excel to JSON?

Excel files (.xlsx, .xls) use a binary or XML-based format designed for spreadsheet software. JSON, on the other hand, is a lightweight, text-based format that's natively understood by virtually every programming language and web technology. Here are the most common reasons to make the switch:

  • API Integration: Most REST APIs accept and return JSON. If your data lives in Excel, you'll need to convert it before sending it to an API endpoint.
  • Web Applications: Frontend frameworks like React, Vue, and Angular work with JSON data structures. Feeding them Excel data directly isn't practical.
  • Database Import: NoSQL databases like MongoDB store documents in a JSON-like format (BSON). Converting Excel to JSON makes imports seamless.
  • Configuration Files: Many applications use JSON for configuration. Migrating settings from a spreadsheet to JSON is a common task.
  • Data Portability: JSON is human-readable, widely supported, and easy to version-control with Git — unlike binary Excel files.
  • Cross-Platform Compatibility: JSON works the same way on Windows, macOS, Linux, and in cloud environments, with no special software required to read it.

Understanding the Data Mapping

Before diving into methods, let's understand how Excel data maps to JSON. Consider this sample Excel spreadsheet:

Name Age City Email
Alice Johnson 29 New York [email protected]
Bob Smith 35 London [email protected]
Carol Lee 42 Tokyo [email protected]

This table converts to the following JSON array of objects, where each row becomes an object and each column header becomes a key:

[
  {
    "Name": "Alice Johnson",
    "Age": 29,
    "City": "New York",
    "Email": "[email protected]"
  },
  {
    "Name": "Bob Smith",
    "Age": 35,
    "City": "London",
    "Email": "[email protected]"
  },
  {
    "Name": "Carol Lee",
    "Age": 42,
    "City": "Tokyo",
    "Email": "[email protected]"
  }
]

Notice how the first row (header) defines the property names, and each subsequent row becomes a JSON object. Numeric values like Age are preserved as numbers, not strings.

Method 1: Manual Conversion

For very small datasets (a handful of rows), you could manually type out the JSON. This is tedious, error-prone, and completely impractical for anything beyond a few records. Common mistakes include:

  • Missing commas between objects or properties
  • Forgetting to quote string values
  • Mismatched brackets or braces
  • Inconsistent key naming

Verdict: Manual conversion is only viable for 5–10 rows at most. For anything larger, use an automated approach.

Method 2: JavaScript with SheetJS (xlsx)

SheetJS (commonly known as the xlsx library) is the most popular JavaScript library for reading and writing Excel files. Here's how to convert an Excel file to JSON in a Node.js environment:

Installation

npm install xlsx

Conversion Script

const XLSX = require('xlsx');
const fs = require('fs');

// Read the Excel file
const workbook = XLSX.readFile('data.xlsx');

// Get the first sheet name
const sheetName = workbook.SheetNames[0];

// Get the worksheet
const worksheet = workbook.Sheets[sheetName];

// Convert to JSON
// header: 1 gives array of arrays; default gives array of objects
const jsonData = XLSX.utils.sheet_to_json(worksheet);

// Write JSON to file
fs.writeFileSync(
  'output.json',
  JSON.stringify(jsonData, null, 2),
  'utf-8'
);

console.log(`Converted ${jsonData.length} rows to JSON.`);

Handling Multiple Sheets

Excel workbooks often contain multiple sheets. Here's how to convert all sheets into a single JSON structure:

const XLSX = require('xlsx');

const workbook = XLSX.readFile('data.xlsx');
const result = {};

workbook.SheetNames.forEach(sheetName => {
  const worksheet = workbook.Sheets[sheetName];
  result[sheetName] = XLSX.utils.sheet_to_json(worksheet);
});

console.log(JSON.stringify(result, null, 2));

This produces a JSON object where each key is a sheet name and each value is the array of row objects from that sheet.

Method 3: Python with openpyxl or pandas

Python is another excellent choice for Excel-to-JSON conversion, especially for data science workflows. The pandas library makes it particularly elegant:

Using pandas

import pandas as pd
import json

# Read Excel file
df = pd.read_excel('data.xlsx', sheet_name=0)

# Convert to JSON
json_data = df.to_json(orient='records', indent=2)

# Write to file
with open('output.json', 'w') as f:
    f.write(json_data)

print(f"Converted {len(df)} rows to JSON.")

Using openpyxl (No pandas dependency)

from openpyxl import load_workbook
import json

wb = load_workbook('data.xlsx')
ws = wb.active

# Extract headers from the first row
headers = [cell.value for cell in ws[1]]

# Build list of dictionaries
data = []
for row in ws.iter_rows(min_row=2, values_only=True):
    row_dict = {}
    for header, value in zip(headers, row):
        row_dict[header] = value
    data.append(row_dict)

# Write JSON output
with open('output.json', 'w') as f:
    json.dump(data, f, indent=2, default=str)

print(f"Converted {len(data)} rows.")

The pandas approach is more concise and handles edge cases like date parsing and mixed data types more gracefully. The openpyxl approach is lighter if you don't need the full pandas ecosystem.

Method 4: Online Converter Tools

Not everyone wants to write code. Online converter tools let you upload an Excel file and get JSON output instantly — no installation, no dependencies, no command line. Here's what to look for in a good online converter:

  • Privacy: The best tools process files entirely in your browser. Your data never leaves your machine.
  • Speed: Browser-based processing with modern JavaScript is fast — often handling thousands of rows in seconds.
  • Formatting Options: Look for options like minified vs. pretty-printed output, array-of-objects vs. array-of-arrays, and custom key mapping.
  • No File Size Limits: Some tools cap uploads at a few MB. Better tools handle larger files gracefully.
  • Multiple Sheet Support: If your Excel file has multiple tabs, the tool should let you choose which sheet to convert or convert all of them.

ConvertMatrix's Excel to JSON converter checks all these boxes. It runs entirely in your browser, supports large files, and gives you clean, well-formatted JSON output in seconds. No signup required.

Common Pitfalls and How to Avoid Them

1. Merged Cells

Merged cells in Excel don't translate cleanly to JSON. The merged value typically only appears in the first cell, and the rest are empty. Solution: Unmerge cells and fill down before converting.

2. Date Formatting

Excel stores dates as serial numbers internally (e.g., 44927 = January 1, 2023). If your conversion doesn't handle this, you'll end up with meaningless numbers instead of dates. Solution: Use libraries that handle Excel date serialization, or format dates as text (ISO 8601: YYYY-MM-DD) in Excel before converting.

3. Empty Rows and Columns

Stray empty rows or columns can produce null values or break the structure. Solution: Clean your spreadsheet by removing blank rows and trimming to the actual data range.

4. Special Characters in Headers

Column headers with spaces, special characters, or leading/trailing whitespace can create awkward JSON keys like "First Name ". Solution: Normalize headers to use camelCase or snake_case (e.g., firstName or first_name).

5. Large Files and Memory

Very large Excel files (50,000+ rows) can consume significant memory when loaded entirely into memory. Solution: Use streaming parsers or process the file in chunks. In Python, pandas supports chunked reading with chunksize parameter.

Best Practices for Excel to JSON Conversion

  1. Clean your data first. Remove merged cells, empty rows, and inconsistent formatting before conversion.
  2. Use the first row as headers. This is the standard convention and produces the most usable JSON output.
  3. Validate your JSON output. Run it through a JSON validator to catch syntax errors before using it in production.
  4. Choose the right data types. Ensure numbers stay as numbers, booleans stay as booleans, and dates are properly formatted strings.
  5. Consider your JSON structure. Array of objects is most common, but nested structures may be needed for complex data relationships.
  6. Keep file sizes manageable. If your Excel file has 100,000+ rows, consider splitting it or using a streaming approach.

Conclusion

Converting Excel to JSON is a fundamental skill in modern data workflows. Whether you're feeding data into a web application, preparing API payloads, or migrating to a NoSQL database, understanding the conversion process helps you avoid common pitfalls and produce clean, usable output.

For quick, one-off conversions, you don't need to write any code. Try ConvertMatrix's free Excel to JSON converter — it processes your files directly in your browser with zero uploads, zero signups, and instant results. Give it a try with your next spreadsheet and see how easy the conversion can be.

Need to work with other formats too? ConvertMatrix supports conversions between CSV and JSON, JSON to CSV, XML, YAML, and many more — all from a single, browser-based tool.

Try Our Free Conversion Tools

Put what you've learned into practice with our browser-based converters: