Returns an array of all Table objects found on the specified web page.
It fetches the given URL, parses it as HTML, and creates a Table for each <table> tag found on the page.
remoteTables(url)
url
A string containing the URL to fetch and parse.
An array of Table objects, one for each HTML table found on the page.
// Get all tables from a Wikipedia page
let tables = remoteTables("https://en.wikipedia.org/wiki/List_of_countries_by_population")
tables.length
3
// Process each table
let tables = remoteTables("https://example.com/data")
tables[0].rows.length
25
// Find the largest table
let tables = remoteTables("https://example.com/data")
let largest = tables.reduce((prev, current) =>
prev.rows.length > current.rows.length ? prev : current
)
largest.headers
["Country", "Population", "Area"]
<th> elements or the first row if no <th> elements are found<thead>/<tbody> structure and simple table layouts