_ivyyq
Last Updated: June 14, 2017
·
5.803K
· haakonn

Pull in Bitcoin prices to Google Spreadsheets

There are many ways to get Bitcoin price data into a Google Speadsheet. Some are unreliable because they are based on scraping HTML tables which change on a whim. Here's a reliable way to do it using BitcoinAverage.com's API. BitcoinAverage.com mainly provides their own average price, but their API also exposed price data from specific exchanges.

First you need to add the ImportJSON function, which is not part of Spreadsheets. There's a recipe here. Here is a direct link to the JavaScript you need to insert.

Then, to get Bitstamp's last price, use this:

=ImportJSON("https://api.bitcoinaverage.com/exchanges/USD"; "/bitstamp/rates/last"; "noHeaders")

If you need something else (different exchange, bid or ask), just read the JSON and change the path (second argument to ImportJSON) accordingly.

Their API is quite neat and RESTful; if you need anything else from them (their average price could be useful, for instance), just go to https://api.bitcoinaverage.com/ and browse.

If you're like me and you need a comma for the decimal separator instead of the period, wrap it in a substitute:

=substitute(ImportJSON(…); "."; ",")

1 Response
Add your response

29030