I have two functions created in the same script and I would like the secondary to activate the main function if cell "N1" on the "Main Stage" page were written "Ok".
function CallFunction() {
var spreadsheet = SpreadsheetApp.getActive();
var ss=SpreadsheetApp.getActive();
var sh=ss.getSheetByName('Main Stage');
var rg=sh.getRange("N1");
var vA=rg.getValues();
if (vA[0][0]=="Ok"){
spreadsheet.getRange('Activate!A1').activate();
spreadsheet.getCurrentCell().setFormula('=MainFunction()');
}
At the moment when trying to activate, it appears in the spreadsheet → You do not have the permission required to setValue (Line 10). From what I saw, I cannot activate my function directly from a spreadsheet cell.
How could I solve this problem?
=MainFunction()
is put to a cell, unfortunately, the custom function cannot usesetValue()
. It is required to use other method and/or workaround. So can you provide=MainFunction()
? – Tanaikeactive
of your replying, when you want to run the function ofMainFunction()
, for example, how about modifyingspreadsheet.getCurrentCell().setFormula('=MainFunction()');
toMainFunction()
? – Tanaike