0
votes

I'm using the IMPORTXML function on google sheets to import the latest visa numbers from the Canadian government however I can import everything on the web page apart from the data/numbers which I think could be down to JavaScript.

I simply just need to find a way to pull that data into the spreadsheet but I'm not experienced with JS.

Here's the website and here's my query:

=IMPORTXML("https://www.cic.gc.ca/english/work/iec/selections.asp?country=au&cat=wh",
"//div[@class='col-md-8']")

Here is an example sheet.

1

1 Answers

0
votes

Unfortunately Google Sheet's formula IMPORTXML is only able to read the static HTML source of the page so it will not be able to read any dynamically inserted element (as you guessed the visa number is dynamically inserted with a Javascript script).

If you inspect in your browser the page source of this site, you will see that the numbers like Candidates in the pool are not there and therefore, IMPORTXML will not be able to reach them.

In order to get them you will need to look for another web scraping technique (with libraries like scrappy and so on).

I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)