保护每个人的细胞,除了功能 [英] Protect a cell for everyone except for function
问题描述
我对应用程序脚本世界是陌生的,我想知道是否有可能为每个人保护一个单元格(他们不能直接更改值),但是可以通过将被调用的函数来更改每个人 ? 谢谢
I am new to the world of apps script and I would like to know if is it possible to protect a cell for everyone(they can't change the value directly) but can be changed by a function that will be called by everyone ? Thanks
edit:用户无法更改单元格的透明度,但是他有一个带有脚本的按钮,可以大胆地更改保护单元格的值,但是当前如果我将单元格置于保护范围和范围"内,则该脚本不起作用
edit: the user can't change direclty the cell but he has a button with a script which shloud be able to change the value of the protect cell but currently if I put the cell in "protect sheets and range" the script doesn't work
推荐答案
是的,有可能.
第一个选项
Yes, it is possible.
First Option
使用服务帐户. //developers.google.com/identity/protocols/OAuth2ServiceAccount"rel =" nofollow noreferrer>假冒文件所有者.
Use the service account which would impersonate the owner of the document.
此处是如何合并服务的示例Apps脚本中的帐户.
Here is an example how to incorporate a service account in Apps Script.
确保您将必要的范围赋予服务帐户 并启用全域委派.
Make sure that you give to the service account the necessary scopes and enable domain-wide delegation.
第二个选项
Second option
第三种选择
Third Option
使用可安装触发器-这将代表您运行授权后.您可以例如设置一个可安装的onEdit触发器,如果用户编辑了某个单元格(例如"A20"),它将触发脚本功能.
Use an installable trigger - this will run on your behalf after you authorize it. You can e.g. set-up an installable onEdit trigger that will fire the script function if a certain cell (e.g. "A20") is edited by the user.
这篇关于保护每个人的细胞,除了功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!