Crypto Tutorials: Binance | Bitfinex | Bitmex | BscScan | Cardano | Coinbase | Coingecko | Coinmarketcap | CoinAPI | Coinranking | Etherscan | | Glassnode | Huobi | LiveCoinWatch | Kraken | Kucoin | Magic Eden | Messari | Nomics | OpenSea | PancakeSwap | Rarible | Rarify | Solanart

    How to connect the PancakeSwap API to Google Sheets

    PancakeSwap is a popular decentralized exchange built on the Binance Smart Chain (BSC). We can use the PancakeSwap API to obtain liquidity and volume information from the PancakeSwap platform. In this tutorial, we’ll show you how to connect the PancakeSwap REST API to Google Sheets in 4 steps:

    1. Install the Apipheny add-on
    2. Choose a PancakeSwap endpoint
    3. Enter your PancakeSwap API request into Apipheny
    4. Run the PancakeSwap API request in your Google Sheet

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

    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.

    open apipheny

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

    Step 2.) Choose a PancakeSwap endpoint

    In this section, we’ll show you how to browse the PancakeSwap 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 3.

    First, open the PancakeSwapAPI documentation page: https://github.com/pancakeswap/pancake-info-api/blob/develop/v2-documentation.md

    This page contains general information about the PancakeSwap API and a list of endpoints:

    PancakeSwap API documentation page
    PancakeSwap API documentation page

    If you scroll down, you will find the endpoints:

    The Summary endpoint
    The Summary endpoint

    An example endpoint is /v2/tokens, which returns the tokens in the top ~1000 pairs on PancakeSwap, sorted by their reserves.

    Each endpoint’s documentation contains a short description of its purpose, its HTTP method and URI, and an example response.

    The Tokens endpoint
    The Tokens endpoint

    All endpoints can be accessed with the following base domain: https://api.pancakeswap.info/

    More PancakeSwap API endpoint examples

    The /v2/tokens/0x… endpoint, which returns the token information, based on address:

    Method: GET
    API URL Path: https://api.pancakeswap.info/api/v2/tokens/address_value 

    Don’t forget to replace address_value wit a real address.


    The /v2/pairs endopoint, which returns data for the top ~1000 PancakeSwap pairs, sorted by reserves:

    Method: GET
    API URL Path: https://api.pancakeswap.info/api/v2/pairs

    Step 3.) Enter your PancakeSwap API request into Apipheny

    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 PancakeSwap REST API endpoint that you need. Now copy and paste your complete PancakeSwap API URL into the Apipheny add-on, where it says API URL Path, followed by any parameters required for your query (if applicable).

    Endpoint Example 1

    For this example, we are using the /v2/summary endpoint, which returns data for the top ~1000 PancakeSwap pairs, sorted by their reserves. This is what the whole URL looks like:

    https://api.pancakeswap.info/api/v2/summary

    No keys required. Here’s what our request looks like entered in Apipheny:

    PancakeSwap API request entered into Apipheny
    PancakeSwap API request entered into Apipheny

    Endpoint Example 2

    Another example endpoint is /v2/tokens endpoint that returns the tokens in the top ~1000 pairs on PancakeSwap, sorted by their reserves. This is what the whole URL looks like:

    https://api.pancakeswap.info/api/v2/tokens
    PancakeSwap API request entered into Apipheny
    PancakeSwap API request entered into Apipheny

    Step 4.) Run the PancakeSwap API request

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

    /v2/summary endpoint result:

    PancakeSwap data imported into Google Sheets
    PancakeSwap data imported into Google Sheets

    /v2/tokens endpoint result:

    PancakeSwap data imported into Google Sheets
    PancakeSwap data imported into Google Sheets

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

    Crypto Tutorials: Binance | Bitfinex | Bitmex | BscScan | Cardano | Coinbase | Coingecko | Coinmarketcap | CoinAPI | Coinranking | Etherscan | | Glassnode | Huobi | LiveCoinWatch | Kraken | Kucoin | Magic Eden | Messari | Nomics | OpenSea | PancakeSwap | Rarible | Rarify | Solanart