TabularJS
All examples
advanced

Scrape a page's tables

Extract HTML tables from a page as JSON.

Point TabularJS at an HTML string and get every <table> on the page as a worksheet — perfect for quick scraping tasks.

js
import tabularjs from 'tabularjs';

const html = await fetch('https://example.com/prices').then(r => r.text());
const result = await tabularjs(html, { name: 'page.html' });

// One worksheet per <table>
for (const sheet of result.worksheets) {
  console.log(sheet.name, sheet.data);
}

Live Preview

Sample output for a file with employee data.

stdout
{
  "worksheets": [
    {
      "name": "Sheet1",
      "data": [
        ["Name", "Department", "Salary", "Start Date"],
        ["Alice Johnson", "Engineering", 95000, "2021-03-15"],
        ["Bob Smith", "Marketing", 72000, "2022-01-10"],
        ["Carol Williams", "Engineering", 88000, "2020-07-22"],
        ["David Brown", "Design", 68000, "2023-02-08"],
        ["Eve Davis", "Engineering", 102000, "2019-11-30"]
      ]
    }
  ]
}