0
votes

I'm getting an error:

imported content is empty

when I use importxml like this:

=IMPORTXML("https://pvpoke.com/rankings/all/1500/overall/","//div[@class='rankings-container clear']/div/div[2]/span[2]")

I've already tested my query in an Xpath helper and got the exact results I wanted. It's only when it get the data to google sheets, nothing works.

2

2 Answers

1
votes

the website you trying to scrape is under JavaScript control. Google Sheets is not capable of importing JS elements. you can test this simply by disabling JavaScript for a given site and what you are left with is able to be scraped. in your case only what you see here:

0

0
votes

Alternate option. Use a custom script to load directly the JSON data.

The script to import JSON data with GoogleSheets (credits to Paul Gambill) : https://gist.github.com/paulgambill/cacd19da95a1421d3164

And the data :

https://pvpoke.com/data/all/overall/rankings-1500.json?v=1.14.5.2

Output :

PokemonData

EDIT :

To output the names of the Pokemon only :

=UNIQUE(QUERY(ImportJSON("https://pvpoke.com/data/all/overall/rankings-1500.json?v=1.14.5.2");"SELECT Col1";1))