XLSX to JSONExcel 2007+ (XLSX)
The modern Excel workbook format.
OOXML-based spreadsheet format introduced with Microsoft Office 2007. TabularJS parses XLSX files with its own parser in the browser and Node.js: no SheetJS, no xlsx dependency.
An .xlsx file is a ZIP archive of XML parts: one part per worksheet, a shared string table, a style sheet and the workbook definition. TabularJS opens the archive, reads those parts and returns one plain JavaScript object with every worksheet in it, ready to save as JSON, send to an API or load into a grid.
The same function runs in Node.js and in the browser. In Node.js, pass a file path or a Buffer. In the browser, pass the File from an <input type="file"> or a drop event, or a Blob from fetch(). The output keeps the sheet layout: data[row][col] mirrors the grid, so data[0][0] is cell A1.
Feature support
What TabularJS extracts from XLSX files
- Every worksheet in workbook order, with its name in
worksheetName. Hidden sheets are included and marked withworksheetState: 'hidden'. - Cell values in
data[row][col]: text as strings, numbers as numbers, TRUE and FALSE as booleans, errors as text such as#DIV/0!. - Formulas as text starting with
=, for example=SUM(D2:D3). Internal prefixes Excel adds to newer functions (_xlfn.and similar) are removed. - Dates as Excel serial numbers (46296 is 2026-10-01), with the cell's number format in
cells['E2'].format. - Styles converted to CSS: fonts, colors, fills, borders and alignment.
worksheet.style['A1']is an index into the workbook-levelresult.stylearray, so a style used by many cells is stored once. - Merged ranges in
mergeCellsas[colspan, rowspan], column widths incolumns, row heights inrows. - Cell comments in
comments['A2'], hyperlinks incells['A1'].options.url, and named ranges inresult.definedNames.
Convert XLSX to JSON in Node.js
import tabularjs from 'tabularjs';
const result = await tabularjs('orders.xlsx');
for (const sheet of result.worksheets) {
console.log(sheet.worksheetName, sheet.data.length, 'rows');
}
const orders = result.worksheets[0];
console.log(orders.data[1]); // [ 'Apple', 3, 0.5, '=B2*C2', 46296 ]
console.log(orders.mergeCells); // { A6: [ 2, 1 ] }
console.log(result.style[orders.style.A1]); // 'font-weight: bold; background-color: #FFFF00'Read XLSX files in the browser
import tabularjs from 'tabularjs';
const input = document.querySelector('input[type=file]');
input.addEventListener('change', async () => {
const result = await tabularjs(input.files[0]);
const sheet = result.worksheets[0];
// First row as keys, the other rows as objects
const [header, ...rows] = sheet.data;
const records = rows.map((row) => Object.fromEntries(header.map((key, i) => [key, row[i]])));
console.log(JSON.stringify(records, null, 2));
});JSON output
{
"worksheets": [
{
"worksheetName": "Orders",
"data": [
["Product", "Qty", "Price", "Total", "Shipped"],
["Apple", 3, 0.5, "=B2*C2", 46296],
["Pear", 2, 0.75, "=B3*C3", ""],
["Total", "", "", "=SUM(D2:D3)", ""]
],
"columns": [{ "width": 100, "title": "A", "type": "text" }],
"rows": { "0": { "height": 21 } },
"cells": { "E2": { "format": "yyyy-mm-dd" } },
"style": { "A1": 0, "E2": 1 },
"mergeCells": { "A6": [2, 1] },
"comments": { "A2": "Fresh stock" }
},
{ "worksheetName": "Notes", "data": [["hello"]] }
],
"style": ["font-weight: bold; background-color: #FFFF00", "font-family: Calibri; font-size: 11pt"],
"definedNames": { "Prices": "Orders!$C$2:$C$3" }
}Output for a small two-sheet workbook, trimmed: only the first column definition and row height are shown and the second sheet is cut. The property names and values are the real ones.
Limitations
- Formulas are not calculated. A formula cell holds the formula text, not the result Excel saved with it.
- Dates are returned as serial numbers. Use the number format in
cellsto decide which columns to convert. - Password-protected (encrypted) .xlsx files are rejected with the error
Workbook is encrypted with a password.
Frequently asked questions
Do I need SheetJS or the xlsx package to read .xlsx files?
No. TabularJS has its own XLSX parser. Its runtime dependencies are JSZip, which opens the ZIP archive, and a small markup parser (@lemonadejs/html-to-json) for the XML parts.
How do I convert the rows to an array of JSON objects?
TabularJS returns rows as arrays so the grid layout is kept. Use the first row as keys: const [header, ...rows] = sheet.data; then rows.map(r => Object.fromEntries(header.map((h, i) => [h, r[i]]))).
Can I get the calculated result of a formula?
Not from the parser. TabularJS returns the formula text, such as =SUM(D2:D3), and never evaluates it. If you need the values, load the result into a spreadsheet component that calculates formulas, such as Jspreadsheet.
How do I read one specific sheet?
There is no sheet option: every sheet is returned. Pick the one you need by name with result.worksheets.find(w => w.worksheetName === 'Orders'). Hidden sheets are in the list too, marked with worksheetState.
Does it read .xlsm files?
Yes, the cell data. A .xlsm file has the same structure as .xlsx, and because the extension is not on the list TabularJS detects the format from the content. You can also pass { extension: 'xlsx' }. VBA macros are not read.
Why TabularJS for Excel 2007+ (XLSX)?
- No external spreadsheet parser dependencies: faster installs, smaller bundles.
- One API in Node.js and modern browsers.
- Output is shape-compatible withJspreadsheet: render parsed data in a live workbook with one call.