user1760144
user1760144

Reputation: 9

How can I parse this URL in google sheets to just show price?

How could I use the "importdata" function in google sheets with this URL to parse the data from the URL and just show the price in a cell?

https://api.coingecko.com/api/v3/simple/price?ids=samoyedcoin&vs_currencies=usd

Here is an example of what I am looking to do, just with the above URL

=VALUE(SUBSTITUTE(SUBSTITUTE(INDEX(IMPORTDATA("https://api.pro.coinbase.com/products/ETH-USD/ticker"),0,2), "price:",""), """", ""))

Upvotes: 0

Views: 646

Answers (2)

SputnikDrunk2
SputnikDrunk2

Reputation: 4038

ALTERNATIVE SOLUTION:

You can also try using a combination of QUERY & REGEXEXTRACT:

=REGEXEXTRACT(QUERY(IMPORTDATA("https://api.pro.coinbase.com/products/ETH-USD/ticker"),"Select Col2"),"price:""(.*)""")

Sample

enter image description here

Upvotes: 1

player0
player0

Reputation: 1

try:

=REGEXEXTRACT(IMPORTDATA(A1), "\d+.\d+|\d+")*1

enter image description here

Upvotes: 1

Related Questions