1

Longtime reader- first time poster...

I'm trying to scrape data from a URL like the "Total Cases" number. But when I copy the XPath from Google Chrome's Inspect tool, and use it in my Google Sheet, I get a "Imported Content Is Empty" N/A error.

Any help?

=IMPORTXML("https://experience.arcgis.com/experience/96dd742462124fa0b38ddedb9b25e429", "//*[@id='ember322']/svg/g[2]/svg/text")
player0
  • 124,011
  • 12
  • 67
  • 124
Zach
  • 13
  • 2

2 Answers2

1

it's empty because Google Sheets does not support scraping of JavaScript elements. you can always test this by disabling JS for a given site and what's left can be scraped - in your case it's nothing:

player0
  • 124,011
  • 12
  • 67
  • 124
0

Data can be scraped with Selenium. Otherwise you can parse directly the jsons. Total cases :

https://services1.arcgis.com/CY1LXxl9zlJeBuRZ/arcgis/rest/services/Florida_COVID19_Cases/FeatureServer/0/query?f=json&where=1=1&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=[{"statisticType":"sum","onStatisticField":"T_positive","outStatisticFieldName":"value"}]&cacheHint=true

Number of deaths :

https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/Coronavirus_2019_nCoV_Cases/FeatureServer/0/query?f=json&where=Country_Region='US'&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=[{"statisticType":"sum","onStatisticField":"Deaths","outStatisticFieldName":"value"}]&cacheHint=true

etc.

E.Wiest
  • 5,425
  • 2
  • 7
  • 12