Grab table from URL in Google App Script

2019-07-27 07:21发布

问题:

In this link answer in line 6, how to identify how many getElement("div") and getElements("div")[number] should be captured from a URL.

This is the URL from where I am looking to capture the table.

回答1:

You may want to look into using import.io, which is a tool specifically for extracting tabular data from web pages, and which has an Apps Script integration.



回答2:

another example could be to pull the table into Sheets and the access the data from within the Sheets. For example:

=importhtml("http://www.tradingeconomics.com/zambia/rating","table",1)

This pulls the first table on the particular webpage into the sheet.