google.script.run allows a client script to call a function on the server.
But how do I run a script function on the client side from Google Apps Script?
google.script.run allows a client script to call a function on the server.
But how do I run a script function on the client side from Google Apps Script?
There's no native way, you'll have to constantly check the GAS for something, eg:
var lastReturn;
setInterval(checkChange, 500);
function checkChange(){
google.script.run.withSuccesshandler(functionToGetAReturnedValue).functionInGSThatWillReturnAValue();
}
function functionToGetAReturnedValue(whatReturned){
if(whatReturned !== lastReturn){
doSomething();
lastReturn = whatReturned;
}
}