Crypto API Tutorials:

Binance API | Bitfinex API | Bitmex API | BscScan API | Cardano API | Coinbase API | Coingecko API | Coinmarketcap API | CoinAPI | Etherscan API | Glassnode API | Messari API | Nomics API | OpenSea API | PancakeSwap API | Rarible API

You might also like:

  • CoinStats: a portfolio manager app 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

How to get data from Etherscan into Google Sheets

Etherscan is a Block Explorer and Analytics Platform for Ethereum, a decentralized smart contracts platform. We can use the Etherscan API to import data from Etherscan into Google Sheets. In this tutorial, we’ll show you how to connect the Etherscan REST API to Google Sheets in 5 steps:

  1. Install the Apipheny add-on
  2. Generate an API key
  3. Choose an Etherscan API endpoint
  4. Enter your Etherscan API request into Apipheny
  5. Run the Etherscan API request in your Google Sheet

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

Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.

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.

open apipheny

Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new

Step 2.) Generate an API key

In your Etherscan account dashboard, click on the API Keys menu item, from the OTHERS section:

Etherscan dashboard
Etherscan dashboard

In the My API Keys section, click the blue +Add button:

My API Keys section
My API Keys section

Complete the name of your API key, then click the Create New API Key button:

The Create API Key window
The Create API Key window

Your API key has been created. Copy it to a safe location, because you’ll need it in the final step.

The generated API key
The generated API key

Step 3.) Choose an Etherscan API endpoint

In this section, we’ll show you how to browse the Etherscan API documentation to find the endpoint that retrieves the information you need from your account. 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 EtherscanAPI documentation page: https://docs.etherscan.io/getting-started/endpoint-urls

The menu on the left contains general information about the Etherscan API and a list of categorized endpoints.

The Etherscan API can be accessed through five 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.etherscan.io

Etherscan API documentation page
Etherscan API documentation page

If we click the Gas Tracker category from the menu on the left, a list of its endpoints will be displayed:

The Gas Tracker category
The Gas Tracker category

An example endpoint is Get Gas Oracle, which returns the current Safe, Proposed and Fast gas prices:

https://api.etherscan.io/api?module=gastracker&action=gasoracle&apikey=YourApiKeyToken

If you use this URL, don’t forget to replace 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:

The Get Gas Oracle endpoint documentation
The Get Gas Oracle endpoint documentation

Step 4.) Enter your Etherscan API request into Apipheny

Once you’ve chosen your endpoint, now 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:

Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) required by your API endpoint. For this example, we are using the GET method.

API URL: In Step 2, we explained how you can find the Etherscan REST API endpoint that you need. Now copy and paste your complete Etherscan 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 Block Number by Timestamp endpoint, which returns the block number that was mined at a certain timestamp. This is what the whole URL looks like:

https://api.etherscan.io/api?module=block&action=getblocknobytime&timestamp=1578638524&closest=before&apikey=your_API_key

If you use this URL, don’t forget to replace your_API_key with the API key you previously obtained, and the timestamp parameter value with a correct unix timestamp of your choice!

Headers aren’t required. You can leave this section blank in Apipheny.

Etherscan API request entered into Apipheny
Etherscan API request entered into Apipheny

Step 5.) Run the Etherscan 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 Etherscan API data to be imported into your Google Sheet. Here’s what our request looked like when completed:

Etherscan data imported into Google Sheets
Etherscan data imported into Google Sheets

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

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


API Tutorials



API Knowledge

What is an API?
What is an API URL?
What are parameters?
What is an endpoint?
What is an API key/token?
What is basic authentication?
What are headers?
What is a GET request?
What is a POST request?


Crypto API Tutorials:

Binance API | Bitfinex API | Bitmex API | BscScan API | Cardano API | Coinbase API | Coingecko API | Coinmarketcap API | CoinAPI | Etherscan API | Glassnode API | Messari API | Nomics API | OpenSea API | PancakeSwap API | Rarible API

You might also like:

  • CoinStats: a portfolio manager app 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