1

I am trying to create a mining calculator in google sheets that pulls data from minerstat.com in semi-real time and uses it to do profit calculations. I am calling the functions I created by just typing functiontobeused() in a cell.

It seems to pull and parse all info correctly the first time just as it should. the problem is it doesn't ever seem to update again. I've tried setting the functions to auto-run with a timed trigger every minute.

I've tried doing the same in the google sheet settings. If I duplicate the page the functions are running on. it seems to do a new api call and the data is refreshed. Unfortunately, it never seems to refresh itself automatically.

If I delete the function cell and retype the function, the data is in fact updated. I'd really like this to be automated though.

function tonCall() {
  var res = UrlFetchApp.fetch("https://api.minerstat.com/v2/coins?list=BTC,eth,ton,rvn");
  var content = res.getContentText();
  var json= JSON.parse(content);
  var ton = json[2];
  tempArray =[];

    for (var obj in ton) {
      if (obj === "id") {continue};

        tempArray.push([obj,ton[obj]])
    }
    return tempArray
}

function ethCall() {
  var res = UrlFetchApp.fetch("https://api.minerstat.com/v2/coins?list=BTC,eth,ton,rvn ");
  var content = res.getContentText();
  var json= JSON.parse(content);
  var eth = json[1];
  tempArray =[];

    for (var obj in eth) {
      if (obj === "id") {continue};

        tempArray.push([obj,eth[obj]])
    }
    return tempArray
}

function rvnCall() {
  var res = UrlFetchApp.fetch("https://api.minerstat.com/v2/coins?list=BTC,eth,ton,rvn ");
  var content = res.getContentText();
  var json= JSON.parse(content);
  var rvn = json[3];
  tempArray =[];

    for (var obj in rvn) {
      if (obj === "id") {continue};

        tempArray.push([obj,rvn[obj]])
    }
    return tempArray
}

Table

General Grievance
  • 4,555
  • 31
  • 31
  • 45
  • In your situation, are these threads useful? https://stackoverflow.com/q/56893480 and https://stackoverflow.com/q/58579114 These samples refresh the functions on Google Spreadsheet. – Tanaike May 01 '22 at 01:33
  • I don't use cell functions much but my guess is that without parameters the function does not know that the spreadsheet has recalculated. – Cooper May 01 '22 at 02:31

0 Answers0