0

Here's the thing: I have a web app that has multiple html pages in it. Code is embedded in a Google spreadsheet. During development I call each page by a separate doGet() function; commenting out the ones I don't want to use. I managed to put my google sheet into the site, end embedded the Web App code for one page. I want to put each of my html pages in different site pages. So how do I call each html page, from the the different doGet functions? Thanks.

1 Answers1

2

You can pass the page name through query string:

function doGet(e) {
  var t = HtmlService.createTemplateFromFile(e.parameter.page);
  return t.evaluate();
}

For example, you have Home.html and About.html, you can show these pages by using:

https://script.google.com/macros/s/.../exec?page=Home
https://script.google.com/macros/s/.../exec?page=About
Xuan Son NGUYEN
  • 366
  • 2
  • 5
  • Thanks for responding, but sorry, I'm not sure how this works. Is "e.parameter.page" a separate page with the different pages listed? Or is there a link to the home page that should be put on each page? Thanks for any help. – Tony Scarpelli Jun 16 '20 at 20:27
  • OK, finally figured most of it out. Got a home page and other pages working. Some of this stuff is more complicated than I thought. Only an Egg. Thanks to all who put code out there for us eggs. – Tony Scarpelli Jun 17 '20 at 17:37
  • This is actually a great idea thanks for sharing – princebillyGK Feb 07 '21 at 07:20