Google sheets - How to import a table from a website

You can easily fetch tables from websites in your Google sheets. To do this you can use the IMPORTTABLE function, which has the following signature:

IMPORTHTML(URL, query, index)

The URL is the URL of the resource you want to import the table from. The query is which type of element to search for one the page, this can be a list or a table. The index is the index of the table or list on the page you want to import, if you want table number two, write 2.

If we for example want this options pricing table from marketbeat, we can write the following:

=IMPORTHTML("https://www.marketbeat.com/stocks/NASDAQ/AMZN/options","table", 1)

This will give us the following table:

imported-options-table-from-google-sheets

You can see a working demo of the result here. This can be combined with query if you want to do something more advanced.

I hope this helps someone out there! :)