BscScan is the leading blockchain explorer, search, API and analytics platform for BNB Smart Chain. We can use the BscScan API to import data from BscScan into Google Sheets. In this tutorial, we’ll show you how to connect the BscScan REST API to Google Sheets in 5 steps:
Apipheny is a free API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to API data sources, easily.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser:
In your BscScan account, click your username, then in the drop-down menu, click the API Keys item:
In the API Keys section, click the blue +Add button:
Complete the name of your API key, then click the Continue button:
Your API key has been created. Copy it to a safe location, because you’ll need it in the last step:
In this section, we’ll show you how to browse the BscScan API documentation to find the endpoint that retrieves the information you need. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 4.
First, open the BscScan API documentation page: https://docs.bscscan.com/getting-started/endpoint-urls
The menu on the left contains general information about the BscScan API and a list of categorized endpoints.
The BscScan API can be accessed through two networks. Depending on which network you choose to access the API, you’ll have a different base URL. In the main section of this page, you can see a table containing these base URLs and the corresponding networks. For this tutorial we chose the Mainnet network.
Its base URL is: https://api.bscscan.com
If we click the Contracts category from the menu on the left, a list of its endpoints will be displayed:
An example endpoint is Get Contract Source Code for Verified Contract Source Codes which returns the Solidity source code of a verified smart contract:
If you use this URL, don’t forget to replace the address value with one of your choice and YourApiKeyToken with the API key you previously obtained in Step 2.
The endpoint’s documentation contains a short description of the endpoint’s purpose, its HTTP method (GET), the URI and an example response:
Once you’ve chosen an endpoint, go back to your Google Sheet and make sure that the Apipheny add-on is open on the Import tab. With the Import tab open, enter these details into the add-on:
API URL: In Step 2, we explained how you can find the BscScan REST API endpoint that you need. Now copy and paste your complete BscScan API URL into the Apipheny add-on, where it says API URL Path, followed by any parameters required for your query (if applicable).
For this example, we are using the Get BNB Balance for a Single Address endpoint, which returns the BNB balance of a given address. This is what the whole URL looks like:
If you use this URL, don’t forget to replace an_address with a real address and your_key with the API key you previously generated in Step 2.
Finally, the last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the BscScan API data to be imported into your Google Sheet. Here’s what our request looked like when completed:
That’s it! You’ve successfully connected your BscScan account to Google Sheets using the BscScan API, Google Sheets API, and the Apipheny add-on.
After making a successful request to the BscScan API, try querying a different BscScan API endpoint, or try using one of the more advanced features in the Apipheny add-on.
Crypto API Tutorials: