0
votes

I'm having a tough time pulling info in on Google Sheets using the ImportXML function. I want to pull in the price of a crypto coin so that I have a real-time feed. The link that I'm hoping to pull from is:

https://www.dextools.io/app/uniswap/pair-explorer/0x40f0e70a7d565985b967bcdb0ba5801994fc2e80

I've tried out a lot of different formulas and keep getting an #N/A or an error. Some of the ones I've tried:

Copy XPATH fully: =IMPORTXML("https://www.dextools.io/app/uniswap/pair-explorer/0x40f0e70a7d565985b967bcdb0ba5801994fc2e80","/html/body/app-root/div[3]/div/main/app-uniswap/div/app-pairexplorer/app-layout/div/div/div[2]/div[2]/ul/li[2]/span")

Shortened XPATH (also tried deleting the second backslash before 'li' but that didn't work): =IMPORTXML("https://www.dextools.io/app/uniswap/pair-explorer/0x40f0e70a7d565985b967bcdb0ba5801994fc2e80","//li[2]/span")

Include class: =IMPORTXML("https://www.dextools.io/app/uniswap/pair-explorer/0x40f0e70a7d565985b967bcdb0ba5801994fc2e80","//li[2]/span[@class='ng-tns-c93-2 ng-star-inserted']")

Does anyone have thoughts? Thanks!

2
The page's source doesn't seem to have too much html on it, so it's likely doing an API call or something. You might try to open the Network Monitor and see if you can find the URL that's fetching the data.Calculuswhiz

2 Answers

1
votes

upon disabling JavaScript the site is empty = can't be scraped by Google Sheets by any import formula.

enter image description here

enter image description here

enter image description here

0
votes

To avoid the problem above, consider using a proper API service that gives you easy access to the data.

For instance you could get Zero price in USD using

=IMPORTDATA("https://cryptoprices.cc/ZERO/")

If you need it in comparison to ETH you could try doing it by hand

=IMPORTDATA("https://cryptoprices.cc/ZERO/")/=IMPORTDATA("https://cryptoprices.cc/ETH/")

Or use a more advanced API such as CoinGecko's

https://www.coingecko.com/en/api