I tried the simplest way of calling Google Apps Script server-side function from my html using the sample code given here https://developers.google.com/apps-script/guides/html/reference/run. It works like a charm.
However, when I try to do the same thing in my actual project which has all the server code in a library, it doesn't work. I keep getting the error
"Uncaught TypeError: google.script.run.doSomething is not a function"
Here is a sample project that I created to recreate the issue
The Gdoc Here look for "Test Menu" and click on "open sidebar" to invoke the functionality. Access the bound script to see the code and the usage of Library.
Any help with this would be much appreciated.
google.script.run.doSomething
should begoogle.script.run.doSomething()
. – Coopergoogle.script.run
API, only public methods of your server-side script are exposed. If you want to reference library methods, then I believe you need a public wrapper for them:function useLib() { return myLibName.doSomething(); }
– tehhowch