Publishing Google Apps Script code snippets

In a previous post I showed how Google Apps Script could return the contents of a script as Json so you could format that for including script samples on web sites.

Today, here is how to use the html service to format that code. Here is the live code, published. It takes arguments of ?module=xxx&template=yyy and will use html template yyy, to publish module xxx. To publish modules in other projects, you simply need to share them as a library and copy in the code for “getMyScript” to that project.

Here’s the complete code.

The default source template provided is as follows.
You also need to include the shared mcpher library. Next, I’ll show how to incorporate this as a code snippet provider in Google and other web sites.
About brucemcp 223 Articles
I am a Google Developer Expert and decided to investigate Google Apps Script in my spare time. The more I investigated the more content I created so this site is extremely rich. Now, in 2019, a lot of things have disappeared or don’t work anymore due to Google having retired some stuff. I am however leaving things as is and where I came across some deprecated stuff, I have indicated it. I decided to write a book about it and to also create videos to teach developers who want to learn Google Apps Script. If you find the material contained in this site useful, you can support me by buying my books and or videos.

Be the first to comment

Leave a Reply

Your email address will not be published.


*


four × three =