Embed Google Script UIs to Pages

This article aims to provide information on embedding Google Script UIs to Pages

Google Scripts are awesome as a multitude of different business applications can be built on top of them. Therefore it's great that you can also use them inside Happeo Pages.

This article assumes you are familiar with Google Script.

Google Script needs 3 things to work with Pages.

  1. First, you need to have a built UI for the script
  2. Second, you need to set the doGet(e) function output with setXFrameOptionsMode()
  3. Third, you need to publish the script
Let's go through the details below.

Build a Google Script UI

For this section, please refer to the Google Script documentation about UIs here.

By default, the HTML output is not allowed to be embedded. To fix this, you need to set the HtmlService output to allow embedding. Below is a short snippet to allow this.

function doGet(e) {  
  var output = HtmlService.createTemplateFromFile('form');
  return output

Publish the script

Publish the script from the top navigation bar under "Publish". From here, select the "Deploy as web app". Set the necessary settings and grab the Current web app URL from the form - it's the one starting with https://script.google.com/macros/s/...

Now you can add a new iframe widget to your Happeo Pages, copy the web app URL as the source and you're all set!