0

I can't run any function from sidebar. Nothing happens when I click the button.

Sidebar HTML:

<input type="button" class="button" value="Stäng via test" onclick="google.script.run.test();">

Code:

function test() {
  SpreadsheetApp.getActive().getActiveSheet().getRange('A1').setValue('I was called!');
}

onclick="google.script.host.close();" works without problem strangely.

Rubén
  • 34,714
  • 9
  • 70
  • 166
Peter B
  • 49
  • 4
  • 1
    Perhaps there is no active sheet in the `google.script.run` context. Review the [My Executions](https://script.google.com/home/executions) dashboard for errors. If it tells _cannot get property getRange of null_ or similar, try `...getActive().getRange('Sheet1!A1')...` – doubleunary Dec 19 '21 at 09:46
  • Are you sure there are no other functions named `test`? – TheMaster Dec 19 '21 at 10:11
  • I reviewed 'My Executions'. The function is never called from sidebar. Tried to change test() to test22() - same result. – Peter B Dec 19 '21 at 11:24
  • 2
    Problem unexpectedly solved. Had to sign out from all google accounts and sign in with just this one account. – Peter B Dec 19 '21 at 11:32
  • You can sign in to other accounts with other browsers and have no problems – Cooper Dec 19 '21 at 17:38

0 Answers0