[英]Publish a Google Spreadsheet through Google Apps Scripts #2
[英]Publish a spreadsheet as a web app through Google Apps Script
我正在尝试通过嵌入在另一个电子表格中的脚本代码将电子表格发布为 Web 应用程序。
感谢 Tanaike 的帮助,我写了这段代码:
// Copies the spreadsheet
var repliesFile = responseTemplate.makeCopy('risposte', newFolder);
// Publish the spreadsheet (Drive Api is enabled)
Drive.Revisions.update({published: true, publishedOutsideDomain: true, publishAuto: true}, repliesFile.getId(), 1);
var webAppUrl = "https://docs.google.com/spreadsheet/pub?key=" + repliesFile.getId();
问题:使用 webAppUrl 我可以看到已发布的电子表格,但我想要的是复制电子表格中 doGet() 函数返回的 html。 简而言之,如果我通过“发布 -> 部署为 Web 应用程序”发布 Web 应用程序,我会得到相同的界面。 有没有办法得到它? 附上几张图片(不要介意html模板中的模板变量)。
感谢您为我提供的所有帮助!
ScriptApp.getService().getUrl()
请注意,此方法仅在您将脚本部署为 Web 应用程序后才有效。 并且 WebApp 仅在包含doGet()
函数时才能按预期工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.