title: Google sheet not updating custom function return value
body: <p>I am very new to Google Apps Script (as well as JavaScript, for that matter), but I have been trying to tinker with it for fun. </p>
  
  <p>I have tried writing a script to fetch API price data in Google Sheets, but am finding that the returned value is not updating when re-evaluating the script in the same cell.</p>
  
  <p>Below is a script to fetch bitcoin price data from Coinbase's API. The script parses the JSON response of the request, as is described <a href="https://developers.google.com/apps-script/guides/services/external#work_with_json" rel="noreferrer">here</a>. </p>
  
  <pre><code>function getBTCPrice() {
    var url = "https://api.coinbase.com/v2/prices/BTC-USD/spot";
    var response = UrlFetchApp.fetch(url);
  
    var jsonSpotPrice = response.getContentText();
    var parseSpotPrice = JSON.parse(jsonSpotPrice);
    var price = "$" + parseSpotPrice.data.amount;
  
    return price
  }  
  </code></pre>
  
  <p>Now, if I type <code>=getBTCPrice()</code> in some cell, and then re-evaluate a few moments later, I get the same price; however, if I evaluate the script in a different cell, I get a different result.</p>
  
  <p>I've read some stuff about Google caching values in cells, so that perhaps the script isn't evaluated because the value of the cell has not changed. Is this the case here? If so, is there a workaround?</p>
  
  <p>Any help is greatly appreciated!</p>