You might like:

  • CoinStats: a portfolio manager for tracking crypto holdings from multiple wallets and exchanges
  • Best Crypto APIs: a comprehensive list of the best APIs for cryptocurrency traders, hodlers, and devs

Crypto API Integration Tutorials

Binance API | Coinbase API | Coingecko API | Coinmarketcap API | APICoinAPI | Bitmex API

How to connect the Coinbase API to Google Sheets

Coinbase is a secure platform that makes it easy to buy, sell, and store cryptocurrency like Bitcoin, Ethereum, and more. We can use the Coinbase API to import data from Coinase into Google Sheets. In this tutorial, we’ll show you how to connect the Coinbase API to Google Sheets in 4 steps:

  1. Install the Apipheny add-on
  2. Choose a Coinbase Endpoint
  3. Add your Coinbase API URL into the Apipheny add-on
  4. Run the Coinbase API request in your Google Sheet

Step 1.) Install and open the Apipheny add-on in Google Sheets

To pull data from the Coinbase API to Google Sheets, first install and open the Apipheny Google Sheets add-on.

Apipheny is a no-code API integrator for Google Sheets that you can use to make unlimited API requests, connect to unlimited APIs, save API requests, schedule API requests, and more. 

1. Install Apipheny by opening the following link on desktop and then clicking the Install button on the page: https://apipheny.io/install

Install Apipheny in the Google Workspace Marketplace
Install Apipheny in the Google Workspace Marketplace

2. After you’ve installed Apipheny, open a Google Sheet and then click on the Add-Ons or Extensions option in the top menu. In the add-ons menu, you should see Apipheny.

Click Apipheny > Import API to open the Apipheny sidebar in your Google Sheets.

Opening the Apipheny add-on in Google Sheets
Opening the Apipheny add-on in Google Sheets

Step 2.) Choose a Coinbase Endpoint

In this section, we’ll show you how to browse the Coinbase API documentation to find the API URL with an endpoint that retrieves the information you need from your account. If you already know your URL, or you want to use the same example URL as us, just skip to Step 3.

First, open the Coinbase API documentation page: https://developers.coinbase.com/api/v2

Coinbase documentation
Coinbase documentation

All Coinbase endpoint URLs are created by appending an endpoint-specific path to the root URL:

https://api.coinbase.com/v2/

Signed endpoints

Some Coinbase API endpoints require HMAC SHA256 and others don’t. This tutorial goes through an example that doesn’t require HMAC SHA256.

“Signed” Coinbase API endpoints that require HMAC SHA256 will not currently work with Apipheny, but endpoints that do not require HMAC SHA256 will work, such as the Get buy price endpoint we covered below.

The reason signed endpoints don’t currently work with our app is because they require an additional parameter called signature, a keyed HMAC SHA256 signature with your secretKey as the key, and a concatenation of all the query’s parameters as the value passed to the HMAC operation. Signed endpoints also require a timeStamp parameter, populated with the request’s millisecond timestamp:

Coinbase API key
Coinbase API key

An example of a signed endpoint is the List transactions endpoint:

List transactions endpoint documentation
List transactions endpoint documentation

You can tell if an endpoint is signed or not, because when you look at the documentation for that endpoint, you’ll see the “This endpoint doesn’t require authentication” phrase. The presence of this phrase means that the endpoint is public (not signed and doesn’t require an API key, a token or a signature).

Public endpoints

Public endpoints can be accessed without an API key and a signature.

As explained before, to identify the public endpoints, you have to look for those which have the phrase “This endpoint doesn’t require authentication” in their documentation.

The only category from the Coinbase API documentation that contains public endpoints, which require no API key, is Data Endpoints:

Data endpoints documentation
Data endpoints documentation

An example public endpoint that requires no key is Get buy price, which gets the total price to buy one bitcoin or ether. It uses the GET method and the URL for this endpoint is:

https://api.coinbase.com/v2/prices/BTC-USD/buy 

The endpoint’s documentation contains its HTTP method (GET), the URI, the cURL command and an example response:

Get buy price endpoint documentation
Get buy price endpoint documentation

Step 3.) Add your Coinbase API URL into the Apipheny add-on

In this section, we’ll show you how to enter your Coinbase API request into Apipheny. This section explains how to enter a supported API request, one that doesn’t require an API key.

Back in your Google Sheet, make sure the Apipheny add-on is open, on the “Import” tab.

After you’ve found the endpoint you need in Step 2, copy the complete URL into the API URL Path field in the Apipheny add-on, followed by any GET parameters required for your query (see screenshot below).

Here’s the example URL endpoint we used, which doesn’t require an API key:

https://api.coinbase.com/v2/prices/:currency_pair/buy

This API URL is the Get buy price endpoint, which returns the total price to buy one bitcoin or Ether. Don’t forget to replace :currency_pair with a real value.

At the top of the add-on select the HTTP method (GET or POST) required by your API endpoint. For this example, we are using GET.

Headers are not required for public endpoints.

Coinbase API request entered into Apipheny
Coinbase API request entered into Apipheny

Step 4.) Run the Coinbase API request in your Google Sheet

Finally, the last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the Coinbase API data to be imported into your Google Sheet. Here’s what our request looked like when completed:

Coinbase data imported into Google Sheets - Get buy price endpoint
Coinbase data imported into Google Sheets – Get buy price endpoint

More Example Coinbase API Requests

Get sell price, which gets the total price to sell one bitcoin or ether. It uses the GET method and its URL is: https://api.coinbase.com/v2/prices/:currency_pair/sell

Don’t forget to replace :currency_pair with a real value.

To use this endpoint, just copy and paste this URL into Apipheny. After you enter the URL into the add-on, click the “Run” button at the bottom of the Apipheny add-on and the data will be imported into your Sheet, as shown in this screenshot:

Coinbase data imported into Google Sheets - Get sell price endpoint
Coinbase data imported into Google Sheets – Get sell price endpoint

– Get exchange rates which returns the current exchange rates. The default base currency is USD,  but it can be defined as any supported currency. Returned rates will define the exchange rate for one unit of the base currency. It uses the GET method and its URL is https://api.coinbase.com/v2/exchange-rates.

To use this endpoint, just copy and paste this URL into Apipheny. After you enter the URL into the add-on, click the “Run” button at the bottom of the Apipheny add-on and the data will be imported into your Sheet, as shown in this screenshot:

Coinbase data imported into Google Sheets - Get exchange rates endpoint
Coinbase data imported into Google Sheets – Get exchange rates endpoint

– Get currencies which lists all currencies known by Coinbase. It uses the GET method and its URL is https://api.coinbase.com/v2/currencies

To use this endpoint, just copy and paste this URL into Apipheny. After you enter the URL into the add-on, click the “Run” button at the bottom of the Apipheny add-on and the data will be imported into your Sheet, as shown in this screenshot:

Coinbase data imported into Google Sheets - Get currencies endpoint
Coinbase data imported into Google Sheets – Get currencies endpoint

That’s it! You’ve successfully connected your Coinbase account to Google Sheets using the Coinbase API, Google Sheets API, and the Apipheny add-on.

After making a successful request to the Coinbase API, try querying a different Coinbase API endpoint, or try using one of the more advanced features in the Apipheny add-on, such as:

Related articles:

Related Posts