Here is my goal: in a Google Document, I want to be able to run a Google Script to populate a section of the Document with the upcoming events from a couple of specific named Google Calendars.
Is this possible?
-
Can I run a script inside a Document? From a button or menu item? I haven’t found documentation about how to do this.
-
In the script, can I target a specific section of the document to be replaced with the new content? Is there an ID on every Element, or could I add a custom attribute to the target Element?
Thanks.
Edit:
I’ve solved #2 and have everything running as I want it to. From the Google Script editor, I can target a specific Document and push the desired content to the desired location.
All that is left is to hook it into any document, so that I can run the script from the document.
Edit:
For #1, it looks like the answer is that Google Documents cannot host scripts. But I can make a general Script, and from it I can open and manipulate any of my Documents.
Do you need it to run from the Document? You’re looking for a list of coming events? Why not do it as a web app? You could pair it up with an HTML template file, and use the HTMLService to generate the end result, after building a string with the events.