title: How to get the current price of a cryptocurrency on google sheets from coinmarketcap?
body: <p>On a google sheets cell I want to get only the current cryptocurrency price with this formula:</p>
  <pre><code>=ValueCrypto(A1)
  </code></pre>
  <p>I tried this function for coinmarketcap:</p>
  <pre><code>function ValueCrypto(crypto) {
  
    var url = &quot;https://api.coinmarketcap.com/v1/ticker/&quot; + crypto + &quot;/?convert=EUR&quot;;
    
    var response = UrlFetchApp.fetch(url);
    
    var data = JSON.parse(response.getContentText());
    
    return data[0].price_eur;
  }
  </code></pre>
  <p>the function give me the error &quot;We no longer serving this endpoint here&quot;</p>
  <p>I also tried to change the endpoint and I added my apy key into the function:</p>
  <pre><code>function ValueCrypto(crypto) {
  
    var url = &quot;pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=&quot; + crypto
    var requestOptions = {
    method: 'GET',
    uri: 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest',
    qs: {
      start: 1,
      limit: 5000,
      convert: 'EUR'
    },
    headers: {
      'X-CMC_PRO_API_KEY': 'myapikey'
    },
    json: true,
    gzip: true
  };
  
    var response = UrlFetchApp.fetch(url);
    
    var data = JSON.parse(response.getContentText());
  
    return data[0].price_eur;
  }
  </code></pre>
  <p>and the errors now are:
  Exception: Request failed for <a href="http://pro-api.coinmarketcap.com" rel="nofollow noreferrer">http://pro-api.coinmarketcap.com</a> returned code 401. Truncated server response: {
  &quot;status&quot;: {
  &quot;timestamp&quot;: &quot;2021-01-02T11:31:39.880Z&quot;,
  &quot;error_code&quot;: 1002,
  &quot;error_message&quot;: &quot;API key missing.&quot;,
  ... (use muteHttpExceptions option to examine full response)</p>