Написание скрипта пользовательских приложений Google Sheets.Я не могу придумать способ для reloadPrices () обновить все ячейки, содержащие = getPrice (id)
function getPrice(id)
{
Utilities.sleep(5000);
try
{
var api = "http://services.runescape.com/m=itemdb_rs/api/graph/";
var i = JSON.parse(UrlFetchApp.fetch(api + id + ".json"))["daily"];
var e = Object.keys(i).sort().reverse()[0];
return i[e];
var sheet = SpreadsheetApp.getActive().getSheetByName('Prices'); //replace 'example' with your actual sheet name
sheet.getRange('B1').setValue(new Date()); // Updates Cell B1 to local time.
}
catch(err)
{
return -100000;
}
}
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet(); // gets opened spreadsheet
var menuEntries = [ {name: "Reload Prices", functionName: "reloadPrices"} ]; //adds element to ribbon sub menu
ss.addMenu("Grand Exchange", menuEntries); //adds ribbon
}
function reloadPrices() {
// I want this to reload all cells containing "=getPrice(id)" example "=getPrice(1404)*2"
}