【发布时间】:2018-06-14 23:57:41
【问题描述】:
我有一个显示方向的弹出框,但它仅在我打开工作表时显示。我希望它在任何有权访问它的用户打开它时运行。澄清一下,其他用户都是编辑。
我的 toast box 确实会显示给其他用户,但 html 应用程序没有
这是我的脚本:
function onOpen() {
var message = "Let's have a productive day!";
var title = 'Welcome Back Greeter';+
SpreadsheetApp.getActiveSpreadsheet().toast(message, title, 10);
var htmlApp = HtmlService
.createHtmlOutput('<p>Make sure you mark the following each time a plate is taken or returned: </p>----Salesperson Name </p>----Time Out </p>----Time In </p>----and if it is Pupped! </p>Do not let Salespeople take plates themselves! </p>As Greeters we are responsible for tracking these plates. This sheet is going to be reviewed with Bob each night with a list of which plates are out for the night as well as a list of the plates that are currently in their folders for the next day. </p> Sincerely, The Plate Fairy</p>')
.setTitle('!!!!! ATTENTION GREETER !!!!!')
.setWidth(350)
.setHeight(400);
SpreadsheetApp.getActiveSpreadsheet().show(htmlApp);
}
【问题讨论】:
-
添加执行脚本。
-
第三行 (
var title = 'Welcome Back Greeter';+) 的;后面有一个+。也许这就是问题所在。 -
我会选择从图像点击运行代码或创建菜单选项。两者都可以正常工作,并且不需要人们在脚本运行之前对其进行授权。如果他们不授权,它将不会为他们运行。在他们查看工作表后检查 Stackdriver 上的控制台日志以自行验证。
标签: google-apps-script google-sheets triggers