Skip to the content
GigaJSON
All tools
Format and check
View and query
Convert
JSON to code
Encode and decode
Sample files
Guides Open GigaJSON

Convert JSON to Excel (.xlsx) without losing zeros, digits or dates

· 5 min read · By Amir Badi

Excel can't simply open a JSON file. You either build the table in Power Query, write a script, or convert the file to .xlsx first. Each way works, and each one can quietly damage data on the way in: an ID of 007 becomes 7, a 19-digit account number loses its last digits, and a list of tags turns into Python syntax. This guide shows the three ways and how to keep the data intact.

Every Python result below was checked by opening the written .xlsx with openpyxl 3.1 (pandas 3.1, Python 3.12). The example is customers.json:

[
  { "id": "007", "name": "Ana", "account": 1234567890123456789,
    "address": { "city": "Lima", "zip": "01234" }, "tags": ["vip", "beta"], "joined": "2026-03-04" },
  { "id": "042", "name": "Ben", "account": 98765,
    "address": { "city": "Oslo" }, "tags": [], "joined": "2026-11-20" }
]

Decide the rows and columns

A spreadsheet is a grid, so the JSON has to become one. The usual mapping:

  • One record per row. The JSON needs to be a list of objects, or an object holding one ({"customers": [...]}).
  • One key per column. Keys missing from some records leave empty cells.
  • Nested objects become dotted columns: address.city, address.zip.
  • Lists inside a record stay in one cell as text (vip, beta or ["vip","beta"]), or become rows of a second sheet if you need to filter by them.

If the JSON is deeply nested or holds several lists, pick the list you want as rows first. Convert JSON to CSV goes through these choices in detail; they're the same for Excel.

In the browser

GigaJSON's JSON to Excel does the mapping above and writes the .xlsx in your browser, so the file isn't uploaded. Paste the JSON or open the file, check the preview of the first rows, and download.

What it writes for customers.json:

id name account address.city address.zip tags joined
007 Ana 1234567890123456789 Lima 01234 ["vip","beta"] 2026-03-04
042 Ben 98765 Oslo [] 2026-11-20

Text stays text, so 007 and 01234 keep their zeros and a value starting with = isn't run as a formula. Numbers and true/false keep their type, except numbers over 15 digits, which are written as text so every digit survives. The header row is bold and stays in view as you scroll. Dates stay as the text they were in the JSON. The file opens in Excel, Google Sheets, Numbers and LibreOffice.

In Excel, with Power Query

Excel for Windows reads JSON through Power Query:

  1. Data > Get Data > From File > From JSON, and pick the file.
  2. Power Query shows a List. Click To Table, then OK.
  3. Click the expand button (two arrows) in the column header, choose the fields, and untick Use original column name as prefix if you want short names.
  4. Nested objects show as Record: expand them the same way. Lists show as List: Extract Values joins them into text, Expand to New Rows gives one row per item.
  5. Set each column's type in the header (ABC for text): make IDs and postcodes text before loading.
  6. Close & Load.

The advantage is the refresh: when the JSON file changes, Data > Refresh All reruns every step. The drawback is the clicking, which you repeat for each nested level. Power Query also guesses column types when it loads, so check that 007 hasn't become 7 before you trust the sheet.

In Python

pandas flattens the records and writes the sheet:

import json
import pandas as pd

with open("customers.json", encoding="utf-8") as f:
    data = json.load(f)

df = pd.json_normalize(data)            # address.city, address.zip ...
df.to_excel("customers.xlsx", index=False)

json_normalize makes the dotted columns. Opening the result shows what went through untouched and what didn't:

Value in the JSON Cell in the .xlsx
"007" 007 (text) kept
"01234" 01234 (text) kept
1234567890123456789 a number Excel shows as 1.23457E+18 last digits lost
["vip", "beta"] ['vip', 'beta'] (text) Python syntax, not JSON
"2026-03-04" 2026-03-04 (text) a text cell, not a date

The leading zeros survive because an .xlsx stores strings as strings, unlike a CSV. The long number doesn't: it's written as a floating-point number, and Excel keeps 15 significant digits of it, so the last four digits are gone. Fix the three problems before writing:

df = pd.json_normalize(data)
df["account"] = df["account"].astype(str)                 # keep all 19 digits
df["tags"] = df["tags"].map(lambda v: ", ".join(v))       # a list as readable text
df["joined"] = pd.to_datetime(df["joined"]).dt.date       # a real Excel date

with pd.ExcelWriter("customers.xlsx", engine="openpyxl", date_format="YYYY-MM-DD") as xl:
    df.to_excel(xl, sheet_name="Customers", index=False)
    xl.sheets["Customers"].freeze_panes = "A2"            # header stays on screen

Now account is the text 1234567890123456789, tags reads vip, beta, joined is a date Excel can sort and filter, and the header row stays put. You need pip install pandas openpyxl first. Use json.dumps instead of ", ".join if someone will read the lists back as JSON.

Limits and gotchas

  • 1,048,576 rows per sheet, the header included. pandas stops with Row numbers must be between 1 and 1048576 when you ask for more. Split the data across sheets or files (the JSON Splitter cuts a big file by record count), or stay with CSV.
  • 16,384 columns, 32,767 characters per cell. Wide, sparse JSON (every record with different keys) can hit the column limit, and long text fields the cell limit.
  • 15 significant digits. IDs, card numbers, tracking numbers and 64-bit timestamps in nanoseconds all need to be text. Large JSON numbers explains why JSON itself can lose them before Excel ever sees them.
  • Dates are text unless you convert them. JSON has no date type, so "2026-03-04" arrives as text. That's safe, but it sorts as text. Convert on purpose, as above.
  • Google Sheets has no JSON import of its own. Convert to .xlsx or CSV, then use File > Import.

Back the other way

To turn a spreadsheet into JSON, save it as CSV and use CSV to JSON, which keeps values like 007 as text. To look at the JSON as a table before you convert anything, open it in the GigaJSON app: the Table view shows a list of objects as a grid you can sort and filter, and Export writes Excel from there too.

Questions

How do I convert JSON to Excel?

Paste or open the JSON in GigaJSON's JSON to Excel tool and download the .xlsx: each key becomes a column and nested fields become dotted columns such as address.city. In Excel for Windows you can also use Data > Get Data > From File > From JSON and build the table in Power Query. In Python, pandas.json_normalize followed by to_excel does it in two lines.

Can Excel open a JSON file directly?

Excel for Windows can, through Power Query: Data > Get Data > From File > From JSON. It opens the file as a list or record that you turn into a table and expand column by column. Double-clicking a .json file doesn't open it in Excel.

Why does Excel change my long ID numbers?

Excel stores numbers with 15 significant digits. A 16 to 19 digit ID, such as an order or account number, loses its last digits and shows in scientific notation. Write those values as text: in pandas with astype(str), or with a converter that keeps numbers over 15 digits as text.

How many rows can I convert to Excel?

A sheet holds 1,048,576 rows including the header, so at most 1,048,575 records, and 16,384 columns. A cell holds 32,767 characters. For more data, split the file or use CSV, which has no row limit of its own.

Is .xlsx better than CSV for Excel?

For people who open the file in Excel, yes. An .xlsx stores each cell's type, so text such as 007 stays text and nothing is guessed. A CSV is plain text: Excel guesses types when you double-click it, drops leading zeros, cuts long numbers and turns some values into dates.

More from the blog