首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何让Google sheet Apps脚本为所有具有编辑权限的用户运行onOpen功能

如何让Google sheet Apps脚本为所有具有编辑权限的用户运行onOpen功能
EN

Stack Overflow用户
提问于 2018-06-15 07:57:41
回答 2查看 970关注 0票数 1

我有一个弹出框,显示方向,但它只在我打开工作表时显示。我希望它在任何有权访问它的用户打开它时运行。只是为了澄清一下,其他用户都是编辑。

我的吐司框确实会显示给其他用户,但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);
    }
EN

回答 2

Stack Overflow用户

发布于 2018-06-15 15:54:09

用户必须授予您的脚本权限才能打开对话框。因此,您需要让他们创建一个他们将授权的installable onOpen trigger,并在随后打开时显示您的对话框。

你不能强迫他们这样做,你只能给他们提供类似自定义菜单选项的选项。

票数 1
EN

Stack Overflow用户

发布于 2018-06-15 08:13:59

只有当所有者或编辑打开文档时,才会触发简单触发器。另一方面,简单的触发器有几个限制,比如他们不能打开对话框,侧边栏等等。

有关详细信息,请参阅Simple Triggers

值得注意的是,目前有一些与此主题相关的开放问题。我已经在我对"You do not have permission to call showModalDialog"的回复中提到过

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50867457

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档