函数onOpen()没有运行 [英] function onOpen() is not running
问题描述
我的功能包括向文档添加菜单和烤面包。我已验证触发器(onOpen)也已设置。它只适用于用户进入工具,脚本管理器,运行。我们有太多背景太多的用户期望知道如何去做。为什么它不工作? (使用Chrome)
My function includes adding a menu and toast to the document. I have verified that the trigger (onOpen) is set as well. It only works when a user goes into Tools, Script Manager, Run. We have too many users with too many backgrounds to expect then to know how to do this. Why isn't it working? (Using Chrome)
function onOpen()
{
var menus = [{name: "Advance in Workflow", functionName:"sendEmail"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu("Auto Advance FG Workflow", menus);
//sheet.toast(Notify/Remind users);
sheet.toast("While you are here we kindly ask that you do not add, modify or remove any columns.","Welcome - " + username,8);
}
谢谢,
Thanks,
推荐答案
我遇到了同样的问题。
我意识到,有时Google会创建某种缓存脚本曾经有一个测试脚本,我通常会改变它的内容,有时,脚本运行,如果我没有)。
I realized, sometimes Google create some kind of cache of the scripts (I'm used to have a "test" script and I usually alter it's content, and, sometimes, the script runs as if I didn't).
所以,我做了什么解决了onOpen()不起作用的是手动更改函数名称和添加触发器。
So, what I did that solved the onOpen() not working was changing the function name and ading a trigger manually.
转到资源 - >当前脚本的触发器...
Go to "Resources -> Current script's triggers…"
选择打开时运行的函数
Choose the function to run on open
它在这里像一个魅力!
这篇关于函数onOpen()没有运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!