首页 > 解决方案 > How do I protect a shared google sheet with and still allow the script button to work?

问题描述

I have a sheet that is shared with quite a few people. They are supposed to fill in 5 cells, click the script button and it will insert the text below and sort it by date.

I created the script and assigned it to the button for this.

I need to protect the entire sheet except the 5 cells and the button.

When I add the protection nobody can click on the button. Is there a workaround?

标签: google-sheetsgoogle-sheets-macrosgoogle-apps-script-addon

解决方案


回答:

您可以使用受保护的范围来保护工作表不被编辑,但预定义的单元格除外。

脚步:

  • Data > Protected sheets and ranges按照表格用户界面中的菜单项进行操作。
  • 单击+ Add a sheet or range新打开的侧边栏中的按钮。
  • 单击Sheet选项卡。
  • 选择您希望保护的工作表。
  • 单击 (✓)标记Except certain cells复选框,并以 A1 表示法选择您希望用户编辑的 5 个单元格。例如D1:D6.
  • 点击Ok
  • 点击Set permissions
  • 在下拉列表中保持Restrict who can edit this range选中状态,然后按。Only youDone

这已经足够了 - 从这里您共享工作表的任何人都将拥有对您在例外规则中指定的特定五个单元格的编辑权限。只要用户已经验证了作为他们运行的功能,该按钮也是可点击的。

参考:


推荐阅读