Imports data from a table or list within an HTML page.
Sample Usage
IMPORTHTML("http://en.wikipedia.org/wiki/Demographics_of_India","table",4)
IMPORTHTML(A2,B2,C2)
Syntax
IMPORTHTML(url, query, index)
-
url
- The URL of the page to examine, including protocol (e.g.http://
).- The value for
url
must either be enclosed in quotation marks or be a reference to a cell containing the appropriate text.
- The value for
-
query
- Either "list" or "table" depending on what type of structure contains the desired data. -
index
- The index, starting at1
, which identifies which table or list as defined in the HTML source should be returned.- The indices for lists and tables are maintained separately, so there may be both a list and a table with index
1
if both types of elements exist on the HTML page
- The indices for lists and tables are maintained separately, so there may be both a list and a table with index
Example 1 - Import the table of Chrome User agents from https://whatmyuseragent.com/browser/ch/chrome/chrome-92
If we put the URL into cell A2
To get the table loaded into the cell B2 onwards, insert the formula =IMPORTHTML(A2,"table",1) and press Enter. Results shown in the following screenshot