Import Coinbase Data to Google Sheets
In this guide, we’ll walk through how to pull cryptocurrency market data from the Coinbase Digital Currency API directly into Google Sheets, using the API Connector add-on for Sheets. For this example we’ll only access Coinbase’s open, unauthenticated endpoints, so we don’t need to get an API key. Coinbase doesn’t provide that much data via these endpoints (CoinGecko is generally better in that respect), but it is easy to use and useful for getting a comprehensive list of exchange rates in one go.
- Before You Begin
- Part 1: Create your API Request URL
- Part 2: Pull API Data into Sheets
- Part 3: More Example API URLs
BEFORE YOU BEGIN
Click here to install the API Connector add-on from the Google Marketplace.
PART 1: CREATE YOUR COINBASE API REQUEST URL
We’ll follow the Coinbase API documentation to access the latest exchange rate data for Bitcoin.
- API root: https://api.coinbase.com
- Endpoint: /v2/exchange-rates
- Query String: ?symbol={{currency}}
Query String Example: ?currency=BTC
Putting it together, we get the full API Request URL:
https://api.coinbase.com/v2/exchange-rates?currency=BTC
PART 2: PULL COINBASE API DATA INTO SHEETS
We can now enter all our values into API Connector and import Coinbase API data into Google Sheets.
- Open up Google Sheets and click Add-ons > API Connector > Open.
- In the Create tab, enter the API URL we just created.
- Leave the Headers section empty. The market data part of the Coinbase API is public, so we don’t need any headers or other authentication. We don’t need extra authentication either, so just leave that set to None.
- Create a new tab, and click ‘Set current’ to use that tab as your data destination.
- Name your request, and click Run. A moment later you’ll see the latest exchange rate data for Bitcoin appear in your Google Sheet:
- If you’d like to see the data in columns instead of rows, create a second sheet and include the Sheets function
=transpose(BTC!1:2)
PART 3: MORE EXAMPLE API URLS
Experiment with endpoints and query strings as described in the documentation to see other types of currency and crypto data from the API. For example, you can try the following URLs, one at a time (substitute in other currency symbols or dates, if you like).
- list of all currencies and corresponding symbols
https://api.coinbase.com/v2/currencies
- current spot price of any currency pair (the spot price is usually between the buy and sell price)
https://api.coinbase.com/v2/prices/BTC-USD/spot
- historical price snapshot of currency pair at a specified date
https://api.coinbase.com/v2/prices/BTC-USD/spot?date=2020-01-01
P.S. For dozens of other step-by-step guides for connecting crypto (and other) APIs to Google Sheets, click here: Knowledge Base
Im going to try this. I need to see how good or badly I’ve done this year. De-fi……
haha, good luck!