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!
upon disabling JavaScript the site is empty = can't be scraped by Google Sheets by any import formula.
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
Related
I want to get the price from mercari, a japanese online shop.
For example, in this link, I like to get 1,488.
https://jp.mercari.com/item/m78226870756
when I copy the xpath of
<span class="number">
I get
//*[#id="item-info"]/section[1]/section[1]/div[1]/mer-price//span[2]
Now, using google sheet importxml
=IMPORTXML("https://jp.mercari.com/item/m78226870756","//*[#id='item-info']/section[1]/section[1]/div[1]/mer-price//span[2]")
I receive a
#N/A Imported content is empty.
I would really like to know how to get the price.
I am not familiar with this at all.
Any other way other than google sheet is also welcome.
you are getting #N/A error due to importxml (or any other import) formula does not support the scrapping of JavaScript elements. you can test this always by disabling JS for a given site and what's left can be usually imported into google sheets
The following function in Google Sheets worked until last Friday:
=index(IMPORTHTML("https://finance.yahoo.com/quote/"&B1&"/key-statistics?p="&B1&"","table",
2),5,2)
This function would go to the statistics section in Yahoo Finance and extract the Market Cap from a stock. It stopped working today and I'm not sure why.
I tried using the following command in the Chrome console to get the table number and played with the table indices for the IMPORTHTML function but no luck:
var i = 1; [].forEach.call(document.getElementsByTagName("table"),
function(x) { console.log(i++, x); });
Did Yahoo do something to make this no longer work? OR are my indices just wrong now?
I tried using every IMPORT formula of Google Sheets and unfortunately, it is returning the same error every single time.
It seems that Yahoo changed some things in their website and it resulted to the import formula not to work anymore.
I suggest finding another website/data source that will give you the same information that you need. Or if you want to stay with Yahoo Finance, you can explore and try to use their API if you want (link-here).
EDIT: Upon further checking, it seems that this issue is only happening on some of the tickers and some webpage in Yahoo Finance. Another option would be waiting for Yahoo to fix the issue.
First post on Stack Overflow! I have minimal IT/Dev background, and I was just trying to learn how to data scrape using the Import XML function in Google Sheets to get a little experience with the function and I've ran into a speed bump, hoping you can help!
I've been successful in my attempts to pull the data I would like so far, but there is a tiny amount of information I would also like to extract, but can't really figure it out thus far. I can see the information in Google DevTools. (Screenshot attached)
The data is stored in the Class definition line and it defines the time Last Seen, accessible one of two ways.
URL : https://us.tamrieltradecentre.com/pc/Trade/SearchResult?ItemID=11807&SortBy=Price&Order=asc
Desired function from ImportXML would be to pull the text, or the URL Extension - With the information of one of those two pieces of information
Thanks for your help!
*EDIT Added Google Sheets Screenshot
Devtool Screenshot
Google Sheets Screenshot
Red Circles for Values I Would Like To Import
You want to retrieve the values of "Last seen" like "1 Hour ago" from the URL using IMPORTXML.
When I checked the site of the URL, it was found that at the URL you want to use, the values like "1 Hour ago" are put using Javascript. In this case, unfortunately, that cannot be retrieved using IMPORTXML. Because IMPORTXML cannot evaluate Javascript.
I am trying to apply 2 filters with Google Analytics Spreadsheet Addon. I want to find the organic session in the specific pagePath. I used semicolon between the 2 filters
="ga:pagePath"&Report!$P9&Report!$G9;ga:medium==organic.
But after entering, I got Formula parse error. return. I couldn't figure out why it doesn't work.
You may try using , instead of ; as seen in this example. Also, from this documentation, to add more than one filter, you need to first think about how you want to filter the data. It's either be an and(;) or an or(,).
I'm having some problems with ImportXML in my Google Spreadsheet. I currently have two sheets, each with their own ImportXML, retireving (basically) the same data - the server providing the data has updated their feed service to require the use of a user-specific "key" in the URL to track who is retrieving what. Prior to this change, my ImportXML worked just fine. They are about to turn off the non-key feeds, and my spreadsheets are about to break.
In the first (working) sheet, this is the feed.
I can import the data sucessfully by using the following syntax in cell A1:
=importXML(ʺhttp://atilla.hinttech.nl/fseconomy/xml?id=18649&key=M3LRG43T&query=GroupLogByMonth&month=10ʺ,ʺ//GroupLogByMonthʺ)
In the new (non-working) sheet, the URL to the feed (including my user-specific "keys") is here.
I am unable to create a working importXML on this sheet. None of my attempted Xpath queries worked, except "*"; but that resulted in all elements being lumped into a single cell.
I have shared my spreadsheet file (link is in the comments below - I am unable to post more than 2 links) with each of these sheets so that the above examples can be seen and played with. Any advise on the non-working sheet would be wonderful.
In the new XML feed there is no tag "GroupLogByMonth". This might explain why your Xpath query won't return anything when you look for that.
Did the format of the XML change too, next to the new URL?