HTML Service Examples for Google Scripts

The HTML Service of Google Apps Scripts lets you serve HTML web pages with standard CSS and client side JavaScript as a web app. You can also communicate with various Google services and render the results in a HTML5 web page.

For instance, with HTML Service, you can build a Gmail like web app that displays your latest email messages and you can even interact – like delete or reply to emails. Or you can display a range of data from a Google Spreadsheet without making your entire sheet public.

Example #1 – a sample web app that displays a static web page. The script of course needs to be deployed as a web app through the script editor.

Example #2 – Here the page uses CSS and JavaScript to display the current time to the user. Notice how we include the content of external files into the index.html file using the include() method.

Example #3 – Here we’ll display the content of a spreadsheet into a web page. When the index.html file is loaded on the client side, it call the getData() server function and, if the call is successful, the data is rendered using the showData() method.