I have the following script below in Google Sheets set to calculate a travel time from Start to End (2 cells in the sheet that change by row). The script works great! However, for whatever reason, the sheet in the background is calling to google multiple times a day to run the same calculation even those the start or end cells were not changed. (it is possible though if a user updates those cells at which point I do want it to recalculate). What can i do to prevent it from calling google to run the same calculation? I read tried putting in a cache but read on googles website that caching is not permitted.
function GETTIME(start,end) {
var res= UrlFetchApp.fetch("https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins="+start+"&destinations="+end+"&key=MYKEY");
var content = res.getContentText();
var json = JSON.parse(content);
var time=json.rows[0].elements[0].duration.text;
Logger.log(content);
//var dis=json.rows[0].elements[0].distance.text;
var time=json.rows[0].elements[0].duration.text; return time }
function GETTIME(start,end) {
var res= UrlFetchApp.fetch("https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins="+start+"&destinations="+end+"&key=MYKEY");
var content = res.getContentText();
var json = JSON.parse(content);
var time=json.rows[0].elements[0].duration.text;
Logger.log(content);
//var dis=json.rows[0].elements[0].distance.text;
var time=json.rows[0].elements[0].duration.text; return time }