有没有人找到一种方法来限制使用谷歌应用程序脚本复制/下载/打印电子表格的访问权限?背景信息:我创建了一个使用 setShareableByEditors(false) 限制编辑者共享权限的脚本。唯一的问题是编辑者仍然可以轻松地复制电子表格,然后广泛共享。我知道 Google 表格中有一个选项可以手动限制此设置,但此解决方案不可扩展,因为我正在尝试管理大量电子表格的共享设置。任何建议将不胜感激。谢谢你!
你可以通过以下方式做到这一点enabling https://developers.google.com/apps-script/guides/services/advanced并使用高级驾驶服务 https://developers.google.com/apps-script/advanced/drive。你会设置file
's restricted
标签到true
。这是一个例子:
function restrictFile() {
var id = '10iM3V2q7FQWBAxy93eN9jvbp_SFco-KLPibeG9XRr71';
// get the file with the Advanced Drive API (REST V2)
var file = Drive.Files.get(id);
Logger.log('File "%s", restricted label was: %s', file.title, file.labels.restricted);
// set the restricted label
file.labels.restricted = true;
//update the file
Drive.Files.update(file, id);
// check the updated file
var updatedFile = Drive.Files.get(id);
Logger.log('File "%s", restricted label is: %s', updatedFile.title, updatedFile.labels.restricted);
}
You can confirm it also in the UI under File > Share... > Advanced:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)