Question

When creating a new Google Document from a script using DocumentApp.create, is it possible to add container-bound scripts to the new document. For example if i want to create a new document that when opened has custom menu items, how would i go about doing this? I have seen some mention that it is possible to achieve this via templates, but is there any way that I can modify the container-bound script for the script-generated document programmatically?

The desired outcome is to be able to create documents from a trigger that contain custom buttons or menu items that allow the user to open a link to a web app with a parameter in the URL that is specific to that document.

Is this possible?

Thanks

Was it helpful?

Solution

programmatically copying template files which already have bound scripts is your only hope right now.

you could have the template script contain some identifying property in its ScriptProperties and pass this to a external Script Library to get back custom menus and functions that you can change over time (in the library), but there isn't a way to make ad hoc changes to container bound scripts.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top