A professional JavaScript library for converting spreadsheet files to JSON format. Supports 16+ file formats for use in Node.js and browser applications.
Website Β· Documentation Β· API reference Β· Live demo Β· Free online converters
Using an AI coding assistant? Point it at tabularjs.com/llms.txt: the API, the output shape and the most common mistakes in one plain-text file.
- 16+ File Formats - Excel, OpenDocument, CSV, Lotus, SYLK, DIF, DBF, HTML tables, and more
- Universal JSON Output - Structured data format for any JavaScript application
- Formula Preservation - Maintains formulas where supported by the format
- Styling & Formatting - Preserves merged cells, styles, and comments
- No Spreadsheet Library Dependencies - No xlsx, no SheetJS - pure JavaScript parsers (only JSZip and an HTML table parser at runtime)
- Framework Agnostic - Works with Vanilla JS, React, Vue, Angular, and Node.js
| Format | Extension | Features |
|---|---|---|
| Excel 97-2003 | .xls |
β Formulas, β Styles, β Merged cells |
| Excel 2007+ | .xlsx |
β Formulas, β Styles, β Merged cells |
| OpenDocument | .ods |
β Formulas, β Styles, β Merged cells |
| Lotus 1-2-3 | .wks, .wk1, .wk3, .wk4, .123 |
β Data |
| CSV | .csv |
β Data |
| TSV | .tsv, .tab |
β Data |
| Plain Text | .txt |
β Data (tab-delimited) |
| XML Spreadsheet 2003 | .xml |
β Formulas, β Merged cells, β Comments |
| DIF | .dif |
β Data, β Labels, β Comments |
| SYLK | .slk, .sylk |
β Formulas, β Data |
| dBase | .dbf |
β Data, β Column types, β Metadata |
| HTML Tables | .html, .htm |
β Formulas, β Merged cells, β Styles |
npm install tabularjsimport tabularjs from 'tabularjs';
// Parse a file
const result = await tabularjs(fileObject);
console.log(result.worksheets[0].data);import tabularjs from 'tabularjs';
const result = await tabularjs('path/to/file.xlsx');
console.log(result.worksheets[0].data);Command Line:
node src/script.js samples/test1.xmlProduction Script Example:
import fs from 'fs';
import tabularjs from 'tabularjs';
const filePath = process.argv[2];
if (!filePath) {
console.log('Usage: node script.js <path-to-file>');
process.exit(1);
}
if (!fs.existsSync(filePath)) {
console.error(`Error: File not found: ${filePath}`);
process.exit(1);
}
try {
const result = await tabularjs(filePath);
console.log(JSON.stringify(result, null, 2));
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}TabularJS is an independent file conversion tool. While it can be used with any application, here are examples showing integration with Jspreadsheet CE and Jspreadsheet Pro for creating online spreadsheets:
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/jspreadsheet-ce/dist/index.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jspreadsheet-ce/dist/jspreadsheet.min.css" />
<script src="https://cdn.jsdelivr.net/npm/tabularjs/dist/index.js"></script>
</head>
<body>
<div id="spreadsheet"></div>
<input type="file" id="fileInput" />
<script>
document.getElementById('fileInput').addEventListener('change', async (e) => {
const file = e.target.files[0];
const result = await tabularjs(file);
// TabularJS output is directly compatible with Jspreadsheet
jspreadsheet(document.getElementById('spreadsheet'), result);
});
</script>
</body>
</html>import { useRef } from 'react';
import jspreadsheet from 'jspreadsheet-ce';
import tabularjs from 'tabularjs';
export default function App() {
const spreadsheet = useRef(null);
const inputRef = useRef(null);
const load = async (e) => {
const file = e.target.files[0];
const result = await tabularjs(file);
// Create spreadsheet from imported data
jspreadsheet(spreadsheet.current, result);
};
return (
<>
<div ref={spreadsheet}></div>
<input
ref={inputRef}
type="file"
onChange={load}
style={{ display: 'none' }}
/>
<input
type="button"
value="Load file"
onClick={() => inputRef.current.click()}
/>
</>
);
}<template>
<div>
<div ref="spreadsheet"></div>
<input
ref="inputRef"
type="file"
@change="load"
style="display: none"
/>
<input
type="button"
value="Load file"
@click="$refs.inputRef.click()"
/>
</div>
</template>
<script>
import jspreadsheet from 'jspreadsheet-ce';
import tabularjs from 'tabularjs';
export default {
methods: {
async load(e) {
const file = e.target.files[0];
const result = await tabularjs(file);
// Create spreadsheet from imported data
jspreadsheet(this.$refs.spreadsheet, result);
}
}
}
</script>| Format | Formula Support | Notes |
|---|---|---|
| XLS | β Full | Decoded from BIFF PTG tokens |
| XLSX | β Full | Native formula strings |
| ODS | β Full | Native formula strings |
| XML 2003 | β Full | Formula attribute |
| SYLK | β Full | E parameter |
| HTML | β Partial | Via data-formula attribute |
| CSV/TSV/TXT | β As text | No formula syntax; a cell written as =SUM(A1:A2) is kept as that text |
| DIF | β No | The format stores calculated values only |
| DBF | β No | Database format, no formulas |
| Lotus | β No | Calculated values only; formula tokens are not decoded |
TabularJS is designed as a lightweight parser focused on data extraction and essential spreadsheet features. The following advanced features are intentionally not supported:
Not Supported:
- Charts and graphs
- Pivot tables
- Macros and VBA code
- Images and embedded objects
- Print settings and page breaks
Limited Support:
- Advanced conditional formatting
- Complex data validations
TabularJS prioritizes data, formulas, basic styling, and structural elements for web-based applications.
TabularJS includes comprehensive test coverage with 312+ test cases covering all supported formats.
Run Tests:
npm testTest Coverage:
- CSV/TSV parsing with edge cases
- Excel (.xls, .xlsx) format validation
- OpenDocument (.ods) structure
- Legacy formats (Lotus, SYLK, DIF, DBF)
- HTML table parsing
- Formula preservation
- Style and formatting extraction
TabularJS is part of a suite of JavaScript tools for building modern web applications:
- Jspreadsheet - Lightweight JavaScript spreadsheet component
- LemonadeJS - Micro reactive JavaScript library
- CalendarJS - JavaScript calendar and date picker
For technical support and questions, please contact: support@jspreadsheet.com
- Website: tabularjs.com
- GitHub: github.com/jspreadsheet/tabularjs
- NPM:
npm install tabularjs
MIT