Docs

remoteTables

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.

Syntax

remoteTables(url)

Parameters

Return value

An array of Table objects, one for each HTML table found on the page.

Examples

// 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"]

Notes

See also