Google工作表,运行作为所有者的功能

编程入门 行业动态 更新时间:2024-10-28 18:33:13
本文介绍了Google工作表,运行作为所有者的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

好的,我对于SO非常新颖,并且对JS和Sheets也很新颖。我正在写一张工作表,每个班次有3个班次,首页和4页。除了轮班时间,上午,下午和新台币,每个班次的每个相应的表格都是相同的。 必须处理一些胖手指的人,我认为最好保护床单和打开范围可以填写。启动时只显示首页。我提供了一个开始和结束转换选项的菜单。运行开始班次,并显示相应的班次页面,然后运行结束班次,他们被隐藏。 问题是,我不运行此显示/隐藏,并且作为床单被保护既不能用户。是否有可能让JS的一部分以拥有者权限运行,而不管谁通过菜单调用它? 从可安装的触发器可能是可能的,但是我还没有从菜单项中找到如何操作。

解决方案

我尝试创建一个改变单元格值的菜单项。不幸的是,它不会触发onEdit事件处理程序。所以,我怕你可以从菜单项中做到这一点。解决方法是将验证规则添加到单元格以创建下拉菜单。

对于那些对步骤感兴趣的人:

首先,工作流程:

  • 电子表格有一个名为 Shift
  • 用户可以将值更改为开始,结束或
  • 设置相应的保护当Shift的值改变时
>

下面是步骤:

  • 创建一个函数,比如 unprotect(),它检查Shift是否为活动单元格,并设置适当的保护在您的项目脚本编辑器中,转至 Resources
  • / em>
  • 创建以下规则:从电子表格运行取消保护 on edit
  • 由于 unprotect()是已安装的触发器,它将以拥有者权限运行。
  • Ok I'm very new at SO and and reasonably new with JS and Sheets. I am writing a sheet for work that runs over 3 shifts with a front page and 4 sheets for each shift. Each corresponding sheet for every shift is identical except for the shift time, AM, PM, and NT. Having to deal with some fat fingered people I thought it would be best to protect the sheets and open ranges that can be filled in. On start up only the front page shows. I supply a menu with Start and End shift options. Run Start shift and the appropriate shift pages are shown, and then run End Shift and they are hidden. The issue is that I don't run this show/hide and as the sheets are protected neither can the user. Is it possible to have a section of JS run with owner privilege regardless of who invokes it via the menu? It may be possible from an installable trigger but I have not yet hunted down how from a menu item.

    解决方案

    I tried creating a menu item which changes a cell value. Unfortunately it won't trigger the onEdit event handler. So, I'm afraid you can do it from a menu item. A workaround would be adding validation rule to a cell to create a drop-down menu.

    To those interested in the steps:

    First, the workflow:

    • The spreadsheet has a cell called "Shift"
    • The user can change the value to "Start", "End", or ""
    • Set the appropriate protection when the value of "Shift" changes

    Here are the steps:

  • Create a function, say unprotect(), which checks if "Shift" is the active cell and sets the appropriate protection
  • In your project script editor, go to Resources > Current project's triggers
  • Create the following rule: run unprotect from spreadsheet on edit
  • Since unprotect() is an installed trigger, it will run with the owner permission.
  • 更多推荐

    Google工作表,运行作为所有者的功能

    本文发布于:2023-10-28 20:09:11,感谢您对本站的认可!
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:所有者   功能   工作   Google

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!