Import Binance Data to Google Sheets
In this guide, we’ll walk through how to pull cryptocurrency market data from the Binance API directly into Google Sheets, using the API Connector add-on for Sheets. For our first example we’ll access Binance’s open, unauthenticated endpoints, so we don’t need to get an API key.
The Binance API is, in my opinion, a bit confusing because it returns data in currency pairs (e.g. BTCAUD, BTCBBTC, BTCBIDR, BTCBKRW, BTCBRL, BTCBUSD, etc.). Other crypto APIs would just return “BTC”, either in USD or in the conversion currency of your choice. But as long as you’re aware of that, it isn’t too hard to get used to. Also, the nice thing about Binance is that it provides some detailed data that other APIs don’t, like open orders and candlestick chart data.
If you want to skip the details, you can jump right to the end and grab a copy of the Binance crypto tracking template.
- Before You Begin
- Part 1: Create your API Request URL
- Part 2: Pull Binance API Data into Sheets
- Part 3: More Example Binance API URLs
- Appendix: Binance Template
BEFORE YOU BEGIN
Click here to install the API Connector add-on from the Google Marketplace.
PART 1: CREATE YOUR API REQUEST URL
We’ll first follow the Binance API documentation to access 24 hour price change statistics for all currency pair symbols.
- API root: https://api.binance.com
- Endpoint: /api/v3/ticker/24hr
Putting it together, we get the full API Request URL:
PART 2: PULL BINANCE API DATA INTO SHEETS
Now let’s paste that URL into API Connector.
- Open up Google Sheets and click Add-ons > API Connector > Open.
- In the Create tab, enter the Request URL we just created
- Leave the Headers section empty. Binance’s market data endpoints are public, so we don’t need any headers here. We don’t need extra Authentication either so 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 24 hour rolling window price change statistics for all Binance’s supported currency pairs:
PART 3: MORE EXAMPLE BINANCE API URLS
Experiment with endpoints and query strings as described in the documentation to see other types of crypto data from the API. If you just want to jump in and get a feel for it, play around with the URLs you enter into the API URL path field. Try the following (one at a time).
- latest price of BTC in USD
- recent trade orders for specified currency pair
- order book data (list of open orders for specified currency pair). Select the “compact” report style for this one to avoid all the data lining up on a single row.
- Kline/candlestick chart data. Again select the “compact” report style.
- historical trades data requires an API key. For this you’ll need an account at Binance. You can retrieve your API key by navigating to the API Management section of your account (located under Settings). Enter your key into the Headers section of API Connector, where Key =
X-MBX-APIKEY, and Value =
your API key
APPENDIX: BINANCE TEMPLATE
In this template, everything is configured for you to simply type in whatever coins you’re interested in and get a dashboard like below:
You can jump right to a copy of the template here (click File > Make a copy to make your own copy). Happy data grabbing!
P.S. For dozens of other step-by-step guides for connecting crypto (and other) APIs to Google Sheets, click here: Knowledge Base