0
votes

I am trying to pull in information from a table of businesses - company names, addresses, phone numbers - that are formatted similarly. I'm able to pull in that information through IMPORTHTML (and IMPORTXML) for the first page of results when I load the URL. However, there are multiple tabs of the table under the same URL.

How do I write the IMPORTHTML formula so it will pull in relevant information from the other table tabs?

URL (in A2 of Google Sheets): https://www.tcia.org/TCIA/Directories/FindQualifiedTreeCare.aspx?State=MD

Formula:

=IMPORTHTML(A2,"table",3)
2

2 Answers

0
votes

unfortunately, that is not possible in Google Sheets because the URL is the same for all page views

enter image description here

0

0
votes

As mentioned by @player0, this is not possible because URL is same for every Page.

Take a look at javascript function for each links

For the Page 1:

__doPostBack(
  'ctl01$TemplateBody$WebPartManager1$gwpste_container_MemberResults$ciMemberResults$gvSearchResults',
  'Page$1')

For the Page 2:

__doPostBack(
  'ctl01$TemplateBody$WebPartManager1$gwpste_container_MemberResults$ciMemberResults$gvSearchResults',
  'Page$2')

For the Page 3:

__doPostBack(
  'ctl01$TemplateBody$WebPartManager1$gwpste_container_MemberResults$ciMemberResults$gvSearchResults',
  'Page$3')

So when you put this function in your browser console, you will be redirected to corresponded page.

Is it possible do add this function into location bar so we can get a direct URL?

It is not possible for security reasons, browsers block this practice in general.

Any ways to bypass it?

Here are the steps what I would do:

  1. You can use python browser driver to simulate user behavior in browser
  2. Web scrape the data to your local machine
  3. Upload data using Google Sheets API
  4. Parse it how ever you want with Apps Script

I hope it helps