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
}