Import Coinbase Data to Google Sheets

Coinbase is a digital currency exchange for buying and selling cryptocurrency. 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.

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.

  1. Open up Google Sheets and click Add-ons > API Connector > Create New API Request.
  2. In the Create Request interface, enter the Request URL we just created.
    coinbase-img1
  3. 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.
  4. Create a new tab. You can call it whatever you like, but here we’ll call it ‘Coinbase-BTC’. While still in that tab, click ‘Set’ to use that tab as your data destination.
  5. Name your request. Again we’ll call it ‘Coinbase-BTC’
  6. Click Run and a moment later you’ll see the latest exchange rate data for Bitcoin appear in your Google Sheet:
    coinbase-img2

PART 3: COINBASE API + GOOGLE SHEETS NOTES AND EXPANSIONS

    1. 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:
      https://api.coinbase.com/v2/currencies
      https://api.coinbase.com/v2/prices/spot?currency=USD
      https://api.coinbase.com/v2/prices/BTC-USD/buy
      https://api.coinbase.com/v2/prices/BTC-USD/spot?date=2014-01-01
    2. For a more dynamic, ticker-like experience in Sheets, check out the API Connector custom function IMPORTAPI().

Leave a Comment