[Go to site: main page, start]

🐼 tsb – readHtml()

readHtml(html, opts?) mirrors pandas.read_html(). It scans an HTML string for <table> elements and returns one DataFrame per table found.

Live Demo

Paste or edit HTML below, then click Parse.



   

Code Example

import { readHtml } from "tsb";

const html = `<table>
  <thead><tr><th>Name</th><th>Age</th></tr></thead>
  <tbody>
    <tr><td>Alice</td><td>30</td></tr>
    <tr><td>Bob</td><td>25</td></tr>
  </tbody>
</table>`;

const [df] = readHtml(html);
console.log(df.columns);   // ["Name", "Age"]
console.log(df.shape);     // [2, 2]
console.log(df.toRecords());
// [{ Name: "Alice", Age: 30 }, { Name: "Bob", Age: 25 }]

Supported Options