Frage

I've been struggling with this a while. My script runs from within a spreadsheet to update a site with its data formatted as HTML.

Within the script I'm using app.add(app.createHTML(values[i][j])) within a loop over the data range. I'm also appending various panels within this loop.

At the end I then find the page I want to update in the site and call page.setHtmlContent(app) which obviously doesn't work - what do I need to do here instead?

War es hilfreich?

Lösung

The object app is a UiApp instance, not an html content. One should consider it more as a command that tells the Google server to generate an html page using GWT toolkit so obviously (as you said) the code you tried can't work.

If you try to get the content of the shown page using something like

  var htmlContent = UrlFetchApp.fetch('https://script.google.com/macros/s/AKf------Z1BBusUdHBmbWI-eqNjM/exec').getContentText();

you will see that it looks like anything but an understandable html code , plus you will meet issues with authorizations, warning messages and/or 'loading' messages...

As far as I know there is not way to capture the html content from a webapp in a form that would be compatible with the site method page.setHtml, at least not using Google Apps Script methods.

maybe some hack somewhere but not that I know...

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top