Import Binance Data to Google Sheets
Binance is a cryptocurrency trading and tracking platform. 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 this example we’ll only access Binance’s open, unauthenticated endpoints, so we don’t need to get an API key.
If you don’t want to read all the details, feel free to skip ahead to the Binance template!
- Part 1: Create your API Request URL
- Part 2: Pull Binance API Data into Sheets
- Part 3: More Example Binance API URLs
- Part 4: Handle Pagination
- Appendix: Binance Dashboard Template
PART 1: CREATE YOUR API REQUEST URL
We’ll follow the Binance API documentation to access the latest order book data for a pair of currencies.
- API root: https://api.binance.com
- Endpoint: /api/v1/depth
- Query String: ?symbol=CURRENCY_PAIR
Query String Example: ?symbol=BTCUSDT
Putting it together, we get the full API Request URL:
PART 2: PULL BINANCE API DATA INTO SHEETS
We can now enter all our values into API Connector and import Binance API data into Google Sheets.
- Open up Google Sheets and click Add-ons > API Connector > Create New API Request.
- In the Create Request interface, enter the Request URL we just created
- Leave the Headers section empty. The market data part of the Binance API is public, so we don’t need any headers here. We don’t need Authentication either.
- Create a new tab and click ‘Set current’ to use that tab as your data destination.
- From the Output Options menu, select the ‘compact’ report style.
Note that we select compact style because Binance sends API data in a series of arrays, and API Connector’s default parsing method will place these values into separate columns. The compact style enables each array to appear in a new row instead. (More on report styles here: Report Styles).
- Name your request and click Run. A moment later you’ll see the latest bid and ask market data for USD to BTC appear in your Google Sheet:
PART 3: GET MORE BINANCE API DATA
- Experiment with query strings as described in the documentation to see other types of crypto data from the API. For example, you can see trade history with the /trades endpoint:
- Other Binance endpoints like
/api/v1/historicalTradesrequire an API key. You can retrieve this from the API Management section of your account, and enter it into the Headers section of API Connector with a Header key of
PART 4: HANDLE PAGINATION
By default, Binance will return a certain number of records, usually 500. To return more (or fewer) records, change the ‘limit’ parameter, e.g.
APPENDIX: BINANCE DASHBOARD
If you want to skip all the URL entry and research, head over to our pre-built OHLC template and input your own Base/Quote pairs.