0

I would like to import the table on this website http://www1.hket.com/store/general/finance/web/hsioptions_day.html and have it automatically update.

I have tried several ways to import the table to the sheets using

importhtml("http://www1.hket.com/store/general/finance/web/hsioptions_day.html","table",1)

But it seems it is not a table.

I also tried to import the table using

importxml("http://www1.hket.com/store/general/finance/web/hsioptions_day.html",A1)

as the XPath contains double quote I define cell A1 = //*[@id="table1"]/table

But it seems the XPath is wrong and it doesn't work. I've got an empty content error.

I wonder if anyone could help me to import the table properly into the sheet. Once it can be properly imported, I will try using the google script to update it automatically, using this tutorial

https://www.youtube.com/watch?v=ijaj7CXSg-Q&ab_channel=ArgentEngineering

Would anyone give some ideas to me how to properly import this table to the sheet?

I am an absolute noob in this and any help is appreciated.

player0
  • 124,011
  • 12
  • 67
  • 124
Max Cheung
  • 176
  • 3
  • 13

2 Answers2

0

I fear this won't work, your page is built with Javascript, which isn't supported by IMPORTXML (or by Google Sheets in general).

Benoît Wéry
  • 862
  • 1
  • 6
  • 8
  • Do you know any way to scrap it? If googlesheet is not working, can you point me to something I can start with? Maybe thru a python script?I have no idea... – Max Cheung Aug 20 '19 at 07:29
  • None that I know of, from the top of my head. If your site proposes an API, or a javascript-free version, you may try that. Other persons may have found a way around that, but the solutions I know just get the source of the page, not the result after javascript execution. – Benoît Wéry Aug 20 '19 at 08:00
0

all you can scrape from this site is:

=IMPORTXML("http://www1.hket.com/store/general/finance/web/hsioptions_day.html", "//*")

0


and/or also this:

=IMPORTDATA("http://www1.hket.com/store/general/finance/web/hsioptions_day.html")

0


as already mentioned Google Sheets can't handle websites controlled via JavaScript

0

player0
  • 124,011
  • 12
  • 67
  • 124