简体   繁体   中英

accessing Google Apps Scripts scripts in google docs

I am trying to extend google docs via apps scripts. I would like the script to be available whenever a new instance of google docs is opened by me or anyone I give access to. According to the documentation this should be achievable by creating a "container bound script".

In order to do so, I open a new google doc and select edit>script editor.

then, as a test I choose "create script for docs" and then saved the sample code that google provides (I am not including because it is long and anyone can easily access it by following the same steps - the script creates a menu in UI of google doc with items that execute some basic functions when selected).

I then save the script and run the onOpen trigger. When I toggle back to the document the script has run. And, when I open that document subsequently the script is triggered.

However, I am trying to extend the functionality of the docs app, not just one doc "file". When I create a new document the test script is nowhere to be found. It does not initiate automatically and it is not in container bound script editor. Nor does the script appear in the script manager...

How can I access the same script across multiple google doc instances? It doesn't make sense to me that there would not be ability to do so on the app level...am I missing something?

update: since 2013 a lot has changed. you should now use an addon. the older way was to make a copy of your doc that has the script. Those that you share it with will need to re-approve the script permissions. You can do that by including a 'install' menu item.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM