I have this code bound to a spreadsheet. I published a standalone google app script as a library, for which I got an ID.
function callActivateNewMember(){
var scriptId = "<LIBRARY SCRIPT ID>";
google.script.run({
'scriptId': scriptId,
'resource': {
'function': 'activateNewMember'
}
})
}
I got an error message upon execution:
ReferenceError: "google" is not defined.
My intention is simply to keep the code of the application using a spreadsheet and limit the code of the spreadsheet to simply call the function from the standalone code.
To use libraries you import them from the ResourcesTab and then later you call them with normal dot notation.
Go to Resources > Libraries Add a library (this is where you use the script id)
Then you should be ready to go.
In the script use the string that is called "Identifier" in the libraries popup.
LibraryIdentifier.activateNewMember();
You should already be familiar with this idea from logging:
Logger.log("Hi There");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With