HTML content in google apps script

2019-08-10 12:03发布

问题:

how can I modify html code of gogle-site-page that was created with createPageFromTemplate methode?

Look at this:

This is how the page is created:

page.createPageFromTemplate(name,
                            ID,
                            template);

Now i need to add more html content:

var created_page = SitesApp.getPageByUrl(that page);

created_page.setHtmlContent(html code here);

But when I use this setHtmlContent meethode I rewrite the template code. How can I go around this? Is there some way I could just add HTML, not re-write it?

Thank you!

回答1:

doing some string manipulation on a var html = created_page.getHtmlContent() is going to be the idea before setting it again.