XML to JSONXML Spreadsheet 2003
The Office 2003 XML spreadsheet format.
An XML-based spreadsheet format introduced with Microsoft Office 2003. TabularJS reads sheets, values, formulas (converted to A1 notation), styles, merged cells and plain-text comments.
XML Spreadsheet 2003, also called SpreadsheetML, is the plain XML format Excel offers as "XML Spreadsheet 2003". A file is a <Workbook> with <Worksheet>, <Table>, <Row> and <Cell> elements. Many reporting tools and server scripts still generate it, because it is an easy way to produce a file Excel opens without a library.
Formulas in these files are written in R1C1 notation, like =SUM(R[-2]C:R[-1]C). TabularJS converts them to A1 notation, =SUM(B2:B3), so they match what you see in Excel.
Feature support
What TabularJS extracts from XML files
- Every
<Worksheet>with its name inworksheetName. Hidden sheets are marked withworksheetState: 'hidden'. - Values typed by
ss:Type: Number becomes a number, Boolean becomes true/false, String and DateTime stay strings (DateTime keeps the ISO text, such as2026-10-01T00:00:00.000). - Formulas converted from R1C1 to A1 notation, with
=, indata. - Styles from the
<Styles>section (fonts, fills, borders, alignment) as CSS. Hereworksheet.style['A1']is the CSS string itself, not an index. ss:MergeAcrossandss:MergeDowninmergeCells, column widths, row heights and number formats incells[...].mask.- Comments written as plain text in
comments, and<NamedRange>entries inresult.definedNames.
Convert XML to JSON in Node.js
import tabularjs from 'tabularjs';
const result = await tabularjs('sales.xml');
const sales = result.worksheets[0];
console.log(sales.data[3]); // [ 'Total', '=SUM(B2:B3)' ]
console.log(sales.style.A1); // 'font-family: Calibri; font-size: 11pt; font-weight: bold; background-color: #FFFF00'
console.log(result.definedNames); // { Amounts: 'Sales!R2C2:R3C2' }Read XML files in the browser
import tabularjs from 'tabularjs';
// Reports saved as XML Spreadsheet often have a .xls extension.
// The extension decides the parser, so force the XML one.
const file = document.querySelector('input[type=file]').files[0];
const result = await tabularjs(file, { extension: 'xml' });
console.log(result.worksheets.map((w) => w.worksheetName));JSON output
{
"worksheets": [
{
"worksheetName": "Sales",
"data": [
["Region", "Amount"],
["North", 1200],
["South", 800],
["Total", "=SUM(B2:B3)"],
["Checked", ""],
["2026-10-01T00:00:00.000", true]
],
"columns": [{ "title": "A", "width": 100 }, { "title": "B", "width": 100 }],
"mergeCells": { "A5": [2, 1] },
"comments": { "A3": "Plain comment" },
"style": { "A1": "font-family: Calibri; font-size: 11pt; font-weight: bold; background-color: #FFFF00" }
},
{ "worksheetName": "Hidden", "data": [["x"]], "worksheetState": "hidden" }
],
"definedNames": { "Amounts": "Sales!R2C2:R3C2" }
}Output for a small two-sheet file; only the second sheet and the style of B1 are trimmed.
Limitations
- Comments with formatting, which is how Excel usually saves them (the author name in bold), are skipped. Only comments whose
<Data>holds plain text are returned. - Defined names keep the R1C1 notation of the file, for example
Sales!R2C2:R3C2. - Formulas are not calculated, and the formula replaces the cached value in
data. - DateTime values are not converted to Date objects or serial numbers.
- Only the SpreadsheetML schema is supported. Other XML documents fail with
No Worksheet elements found in XML.
Frequently asked questions
What is the difference between XML Spreadsheet 2003 and XLSX?
XML Spreadsheet 2003 is a single plain XML file. XLSX is a ZIP archive of several XML parts and supports more features, such as charts and images. TabularJS reads both into the same worksheets structure.
Why are the formulas different from the ones in the file?
The file stores them in R1C1 notation, relative to the cell. TabularJS converts them to A1 notation, so =SUM(R[-2]C:R[-1]C) in cell B4 becomes =SUM(B2:B3).
My file has a .xls extension but contains XML. Can TabularJS read it?
Yes. TabularJS picks the parser from the extension, so pass { extension: 'xml' } to use the XML Spreadsheet parser for that file.
Can TabularJS read any XML file as a table?
No. It reads SpreadsheetML documents with <Workbook> and <Worksheet> elements. For other XML, parse the document yourself and build the rows.
Why TabularJS for XML Spreadsheet 2003?
- 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.