ConvertCSV

How to Convert Excel (XLSX) to JSON Online and With Code

By Convert CSV Editorial TeamLast updated August 1, 2026

Convert Excel (XLSX) to JSON reliably. Browser, Python, and Node workflows with nested output, type-safe conversion, and no lost leading zeros.

Why Convert Excel to JSON

Excel is where business data lives. JSON is where APIs, apps, and databases expect it to arrive. Converting XLSX to JSON turns a spreadsheet into a shape that developers can consume without manual cleanup every time.

Done right, the JSON keeps types intact, preserves IDs as strings, and skips the empty rows Excel leaves behind.

Pick the Right Path

Match the tool to the frequency of the job.

ApproachBest for
Browser converter (Excel → CSV → JSON)One-off, no install
Python (pandas + openpyxl)Repeatable analytics jobs
Node.js (SheetJS)Backend pipelines, APIs

Step-by-Step: In the Browser

The fastest workflow uses two Convert CSV Online tools.

  • Open the Excel to CSV Converter.
  • Upload the .xlsx and pick the sheet.
  • Download the resulting .csv.
  • Open the CSV to JSON Converter and drop the CSV in.
  • Download the .json and inspect in your editor.

Preview before you convert

Open the file in the Online XLSX Editor to confirm headers and clean out blank rows first.

Step-by-Step: With Python

pandas plus openpyxl reads XLSX directly.

import pandas as pd

df = pd.read_excel("orders.xlsx", dtype={"order_id": str})
df.to_json("orders.json", orient="records", force_ascii=False, indent=2)

Multiple sheets

Emit a JSON object keyed by sheet name.

sheets = pd.read_excel("workbook.xlsx", sheet_name=None, dtype=str)
import json
with open("workbook.json", "w") as f:
    json.dump({name: df.to_dict(orient="records") for name, df in sheets.items()}, f, indent=2)

Nested JSON output

Flat spreadsheets rarely map cleanly to nested JSON. Post-process the flat records to build a nested structure explicitly.

records = df.to_dict(orient="records")
nested = [
    {
        "order_id": r["order_id"],
        "customer": {"name": r["customer_name"], "email": r["customer_email"]},
    }
    for r in records
]

Step-by-Step: With Node.js

SheetJS handles XLSX reading and JSON conversion.

import * as XLSX from "xlsx";
import fs from "node:fs";

const wb = XLSX.readFile("orders.xlsx");
const ws = wb.Sheets[wb.SheetNames[0]];
const rows = XLSX.utils.sheet_to_json(ws, { defval: "", raw: false });
fs.writeFileSync("orders.json", JSON.stringify(rows, null, 2));

Types, Dates, and IDs

The three columns that break most Excel → JSON conversions.

ConcernDo this
Long IDsForce to string (dtype=str, raw: false)
Leading zerosSame—keep as string, do not cast to number
DatesParse to ISO 8601 (YYYY-MM-DD)
CurrencyStore as number without symbols; symbol is presentation
Empty cellsPick null or "" explicitly (defval)

Cleaning Before Conversion

Ten minutes of cleanup save hours of debugging.

  • Delete summary rows at the top or bottom.
  • Remove blank rows and unmerge merged cells.
  • Rename headers to snake_case for easier JS/Python access.
  • Verify one type per column.

Real-World Examples

Common shapes of the workflow.

Seed data for a new app

A product manager keeps categories in a spreadsheet; a developer converts it to JSON for fixtures.

API payload for a bulk import

An operations team hands off a customer XLSX; a backend engineer turns it into a JSON array for the import endpoint.

Migrating to a new SaaS

Legacy data lives in Excel; the target system accepts JSON—this conversion is the bridge.

Common Mistakes

The bugs that show up repeatedly.

  • Auto-casting IDs to numbers and losing leading zeros.
  • Missing sheet name and getting only the first tab.
  • Assuming JSON output is nested when the spreadsheet is flat.
  • Ignoring merged cells that become nulls.
  • Emailing JSON with sensitive data instead of using secure sharing.

Best Practices

Habits that keep JSON output trustworthy.

  • Type all IDs as strings.
  • Emit ISO dates.
  • Version your JSON output next to the source XLSX.
  • Validate output against a JSON Schema.
  • Prefer .xlsx over legacy .xls.

Why Use Convert CSV Online?

Convert CSV Online is free, browser-based, and requires no account for everyday conversions. Chain Excel to CSV → CSV to JSON, or clean up in the Online XLSX Editor first. Client-side workflows run on Windows, macOS, and Linux browsers.

No install, no signup

Great for stakeholders who need JSON once, not a weekly pipeline.

Conclusion

Excel-to-JSON is a common bridge between business data and code. Clean the sheet, force types, and pick the workflow that matches how often you will re-run the conversion.

FAQ

How do I convert Excel to JSON?

In the browser, use Excel to CSV then CSV to JSON on Convert CSV Online. In code, use pandas (read_excel + to_json) or SheetJS (readFile + sheet_to_json).

Can I keep leading zeros?

Yes—force ID columns to string type. In pandas use dtype=str; in SheetJS use raw: false and treat values as strings.

Can I convert to nested JSON?

Not automatically from flat cells. Post-process the flat records to build a nested structure explicitly.

What about multiple sheets?

Read all sheets and emit an object keyed by sheet name, or convert one sheet at a time.

Is browser conversion safe for sensitive data?

Convert CSV Online processes files in your browser for everyday conversions, so sensitive rows stay on your machine.

How should dates appear in JSON?

Use ISO 8601 (YYYY-MM-DD or full timestamp). Avoid locale-specific formats to keep downstream parsing predictable.

References

Convert your CSV in the browser

Preview, clean, and convert CSV files free with Convert CSV Online—no installation and no account required for everyday conversions.