0
votes

I am trying to fetch this website (https://www.covidhotspots.in/?city=Mumbai&source=share) data using Importxml in Google Sheets but it gives me no data.

I am trying to apply below formula but it is giving me #NA

=IMPORTXML("https://www.covidhotspots.in/?city=Mumbai&source=share","//li/text()")

I want to fetch geocodes as mentioned in the below images

Need to fetch geo code

1

1 Answers

0
votes

Issue

IMPORTXML can only read the HTML source of a website. Therefore, those elements and components of a website added dynamically will not be able to be retrieved by the IMPORTXML.

If in your browser you take a look and view the source of the website, specifically focusing on the parent ul element that contains the li that you want to retrieve, you will find that the ul element is empty. This is because the children are inserted dynamically throughout a Javascript script (and that is why when you call this IMPORTXML accordinly to that ul nothing is returned, because it is empty in the source HTML).

Possible workaround

Sometimes, in the Javascript files of the website, you can find out the URL of the source of data being inserted dynamically but that is a tedious task to achieve.

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