简体   繁体   中英

Generate HTML View from Google Sheet using Apps Script

I need to generate/display an HTML page (or iframe or how-ever it could be done on demand from an apps script) from a Google sheet using Apps Scripts. It looks like there's an htmlForms service for Docs, but I can't find the equivalent for sheets.

My goal is to provide a menu item that can parse my data (already done) then call up another page where knockOutJs will be used to transfer the generated JSON into an html preview. Right now my script generates the JSON and if I could use something like

I'm using HtmlService.createHtmlOutputFromFile() to generate the HTML but FormApp.getUi() isn't valid in this context and neither is

You must get a reference to the current SpreadSheet (not the "ActiveSheet", but the entire SpreadSheet object) then call show() passing in your object from createHtmlOutputFromFile() or similar method.

  var htmlRes HtmlService.createHtmlOutputFromFile('YourProjectHtmlFile');
  SpreadsheetApp.getActiveSpreadsheet().show(htmlRes);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM