Google Apps脚本-是否可以仅通过GoogleAppScript允许更改表格中的某些单元格?
我在Google SpreadSheet中制作目录.我的电子表格有一个表,用户可以在其中添加信息.该表是通过脚本(从数据库表中获取数据)动态创建的.
My making a catalog in Google SpreadSheet. My spreasheet has a table where the user can add information. This table is dynamically created through a Script that gets the data from the database sheet.
用户可以编辑表中的某些单元格,然后单击将更改保存回数据库表的按钮.
The user can edit some cells in the table and click on a button that saves the changes back into the database sheet.
我想限制他可以手动编辑的单元格,但是我不能保护这些单元格,因为有一个脚本可以对其进行修改(因为表格是通过脚本动态生成的.)
I want to limit the cells he can edit manually, but I can´t protect theses cells, because there is a script that modifies it (since the table is dynamically generated through a script).
有没有一种方法可以保护单元格,使其只能通过脚本进行编辑?
Is there a way to protect cells so that they can only be edit by a script?
我不能仅仅保护某些范围,因为运行脚本的用户是修改单元格的人.如果我保护范围,则用户将无法手动或使用脚本来更改范围.我想要一种保护范围以防手动输入的方法,但允许用户运行的脚本(不是电子表格所有者)更改单元格.
I can not just protect some ranges, because it is the user that runs the script that modifies the cells. If I protect the ranges, the user can´t change the range either manually or using the script. I want a way to protect the range against manual input, but allow the script, that the user runs (not the spreadsheet owner), to change the cells.
谢谢
不是使用受限脚本,而是使用独立脚本来创建以所有者权限运行的Web应用程序.这是因为有界脚本在执行脚本的用户的权限下运行此脚本.
Instead of using a bounded script use a stand alone script to create a web app that runs with the owner permissions. This because the bounded scripts runs this the permissions of the user that execute the script.
为帮助您的用户执行Web应用程序,我认为您可以创建一个用户对话框或侧面板,以显示指向Web应用程序的链接.
To help you user to execute the webapp, I think that you could create a user dialog or side panel that will display the link to the webapp.