Reputation: 145
Trying to make a spreadsheet on google sheets that scrapes data from a site.
I'm trying to get the sell price of items from rsbuddy exchange, eg:
https://rsbuddy.com/exchange/?id=1745
I have the code on google sheets as:
=IMPORTxml("https://rsbuddy.com/exchange/?id=1745","//*[@id='sell-price']")
But instead of showing me 1734gp
it comes up as ---
on the sheet.
I've tried adding /text()
at the end of the query for the importxml
but it doesn't change anything.
I'm guessing the solution is something similar?
Upvotes: 3
Views: 1064
Reputation: 51
You'll need to do it via JSON, though you can't importJSON natively through Google Sheets. If you add this library as code to your sheet (via the script editor) then you can you can use =IMPORTJSON (with different parameters) to get the data back that you need.
http://blog.fastfedora.com/projects/import-json
Upvotes: 0
Reputation: 1713
I don't believe you can do it with xpath because it's populated dynamically. If you view the full source, you're getting what is there. It's literally ---
You can see the source data here which is in JSON and looks like it's tied to the page url id. Google sheets doesn't natively support json but this good person wrote a script and it seems to work well in my example sheet.
Upvotes: 1