*.gs and Html files
Then, what’s the trick?
Instead, we will need to use the templating method:
html = HtmlService.createTemplateFromFile(filename)
We will get into a little more detail on templates later in this tutorial.
My main reference for this was the Google Apps Script UI best practice guide, and you will see code snippets of the first example there that I have modified for my own example.
The thing is, the explanations were a bit vague for me to work out clearly so I really needed to create an example of my own to work through how to use it. The example below breaks down the steps to create file relationships to make your code look neater. It also dives into some uses of template statements in html.
The Final Result
Take a look at the demo: