HTML Page with Google App Script

To add an HTML file to your Apps Script project, follow these steps:

https://developers.google.com/apps-script/guides/html

  1. Open the Apps Script editor.
  2. At the left, click Add a file add > HTML.
    <!DOCTYPE html>
    <html>
    <head>
    <base target="_top">
    <script>
        function readSSContents()
        {
          //simply call a funcion in script
          var ssContents = google.script.run.myFunction()
        }
        function onSuccess(numUnread) {
            var div = document.getElementById('output');
            div.innerHTML = 'You have ' + numUnread
                + ' unread messages in your Gmail inbox.';
          }
        function getSSContents()
        {
          // call function and get return values
          google.script.run.withSuccessHandler(onSuccess)
              .myFunction();
        }
    </script>
    </head>
    <body>
    Hello World
    <input type="button" value="showSSContents"
        onclick="getSSContents()" />    
    <input type="button" value="Close"
        onclick="google.script.host.close()" />
    <div id="output"></div>
    </body>
    </html>
  3. and in Code.gs
    https://developers.google.com/apps-script/guides/html/communication

    function doGet() {
    return HtmlService.createHtmlOutputFromFile('Index');
    }
  4. Once that basic framework is in place, all you have to do is save a version of your script, then deploy your script as a web app.