Reputation: 35
I am using the IMPORTXML function in Google Sheets to get a price from a website. The query is very straight forward and I manage to get the data I want. However this data will appear in the cell where I wrote the query (which is ok) AND as well in the cell directly below, which prevent me from using a dynamic query with a parameter.
I tried the two following lines of code that have the same effect:
=IMPORTXML(TO_TEXT($A$1)&TO_TEXT(B3)&"/", "//div[@class='PriceHistoryStats--value']")
=IMPORTXML(TO_TEXT($A$1)&TO_TEXT(B3)&"/", "//*[@class='PriceHistoryStats--value']")
Where A1 is the general URL of the website:
https://opensea.io/assets/0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb/
and the column B contains the parameter of the asset from which I am trying to retrieve the price. Currently the line of code is in cell C3. I get a result "Ξ0" returned in both C3 and C4. I need this result to be returned only in C3.
Upvotes: 1
Views: 255
Reputation: 24930
Try it this way - where $A$1
is the url in your last comment:
=IMPORTXML($A$1, "//div[@class='item--large']//div[@class='PriceHistoryStats--stat']/div[@class='PriceHistoryStats--value']/text()")
Upvotes: 1