Excel Import CoinMarketCap API Data with Query

The CoinMarketCap Pro API is a great source for cryptocurrency data on current and historical prices, exchange information and more. If it is your wish to use Excel to import CoinMarketCap API data, and have it updated live, look no further. In this article, I will show you how to use a query to import current prices into Excel and have them updated regularly using the methods shown in the Import JSON Data in Excel article. Be aware that this works best with Excel 2016 or greater, and doesn’t work with Excel for Mac. If you are using Excel 2013 or prior, you will need to install Power Query before attempting these steps.

Getting Current Latest Price Quotes

With the CoinMarketCap API, current quotes are handled by the https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest endpoint. In order for proper data to be returned, a proper API key (sign up on their website) must be passed as a header item and cryptocurrencies to return selected by the id/slug/symbol parameters. For this example, I will use the symbol parameter.

Step 1: Setup the CoinMarketCap Web Request in Excel

To pull the data into Excel, we use a web query. Under the Data tab in the ribbon, select Get Data > From Other Sources > From Web.

From Web dropdown in Excel

Next, we need to input the URL we want to use and setup our API key as a header item to authenticate with CoinMarketCap. Make sure the Advanced radio button is selected. Enter the API URL you would like to get data from in the top box of URL parts. In this case, I have used https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=BTC,LTC to get the latest prices of BTC and LTC. Then, under HTTP request header parameters type X-CMC_PRO_API_KEY in the dropdown box. Paste your API key from CoinMarketCap in the box beside. Click OK. If you are asked how you would like to authenticate with the website, choose Anonymous. By putting our API key as a header item, we are already setup to authenticate with CoinMarketCap, so no further configuration is necessary.

Excel Coinmarketcap API request options showing API key passed as header

Step 2: Create the Tables in the Excel Query Editor

Next, create the right tables using the query editor from the returned data. Because this takes many clicks, please refer to the video below to guide you. The flow is essentially to click into data, we can disregard the status object. Then, convert to table by clicking Into Table as this is already the point we will see the list of quotes. Then, expand the value record by clicking the two arrows on the header and check off anything you are interested in. In this case, I just want the quote so I only expand that and keep expanding records as long as you want to get the data you need. Then, Close & Load.

Step 3: Finished CoinMarketCap Table in Excel and Setup Auto Refresh

Once you click Close & Load in the query editor, you should see the data in Excel as a table.

At this point, you may wish to setup auto-refresh. To do this, go into Connection Properties under Refresh All. Make sure your cursor is on a cell in the table if the Connection Properties button is greyed out.

Connection Properties in Excel

Then, you can configure auto-refresh in the properties by checking the “Refresh every” box and setting the frequency. You can also choose to have the data updated every time the file is opened. Keep in mind that on the Basic plan, CoinMarketCap only allows 300 requests per day so refreshing more often isn’t necessarily better if you don’t require frequent refreshes for your purposes.

Auto-refresh settings for excel coinmarketcap data

That’s it!

Next step: Become a Power Query wizard!

Recommended reading: Collect, Combine, and Transform Data Using Power Query in Excel

24 thoughts on “Excel Import CoinMarketCap API Data with Query”

  1. Great, worked a treat.
    Can you show how to get either BTC into Excel in Euros, or, show how to get the USD/EUR FX rate into excel.
    Thanks.

    1. Would be of interest for me as well-thx
      Converting in Excel by using a fixed exchange rate does not match the figures you see on CMC…

      1. If you convert the rate using a fixed exchange rate it probably won’t match CMC because the EUR market will be run separately than the USD market and therefore converting the BTCUSD rate to BTCEUR won’t necessarily match the exchange rate exactly. Might even be an arbitrage opportunity but usually not.

  2. Thank you! Very thorough and explanatory! I have a problem tho, I can’t sign up fro CoinMarketCap free API, it simply results ‘Not Found’ after I click the button for Sign up. Is this feature still available?

  3. Thanks for the instructions, they were quite helpful. Is there a way to return the price of a coin in BTC value (sats)? E.g. ETH/BTC instead of ETH/USD

    1. The convert option doesn’t just accept fiat currencies, it also accepts BTC as a value. You can use it to get ETH/BTC.

      1. This is great news. Except, I don’t see anything in the instructions about the “convert option”. Can you advise how to do this please?

    1. Not that I know of at the moment using this method. I know they have implemented some of the query code but don’t have the interface set up so you may be able to get someone to set it up on Windows and then open the file on a Mac if you have the latest 365 version. Otherwise, have a look at my Google Maps VBA tutorial (https://syntaxbytetutorials.com/excel-function-to-calculate-distance-using-google-maps-api-with-vba/) The code there could be adapted for use with CoinMarketCap and that will work on mac.

  4. How could I connect from excel to an API that needs me to send him first by POST USER and Password and he answers me with a json where they see a token and then consult again by GET placing the token in the head all this from excel.

    1. You may need to use VBA or multiple queries in this case. However, you could try the “Access Web content” dialog box that pops up when you connect. Screenshot of the access web content dialog

  5. Hi,
    All works well until excel is closed. I use version 2016
    When open the file again is deleting the API.
    It says: ,, we foun a problem ……query tables deleted”
    Don’t understand what the problem is ???

    Do you have any idea?
    Thank you.

    1. Rather than using https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest you would use https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/historical. This is a premium endpoint of CoinMarketCap’s API and is only available on the standard plan and up.

Leave a Reply

Your email address will not be published. Required fields are marked *