如何查看授权用户列表谷歌工作表



我有一个电子表格,我已经授权一些用户访问。现在,我想就一个变化对这些人进行民意调查。如何获取已被授予访问权限的人员(电子邮件地址(的列表?

既然我在这里,我如何确定每个人都有什么访问权限?

感谢

  • 您想要检索Google电子表格的编辑器和查看器列表

我认为为了实现你的目标,需要使用脚本。在这个答案中,我想提出使用谷歌应用程序脚本实现目标的方法。

示例脚本:

请将以下脚本复制并粘贴到谷歌应用程序脚本的脚本编辑器中。并运行myFunction的函数。当显示授权屏幕时,请对作用域进行授权。这样,脚本就运行了。

function myFunction() {
var spreadsheetId = "###";  // Please set the Spreadsheet ID.
var ss = SpreadsheetApp.openById(spreadsheetId);  // or SpreadsheetApp.getActiveSpreadsheet()
var res = {
owner: ss.getOwner().getEmail(),
editors: ss.getEditors().map(e => e.getEmail()),
viewers: ss.getViewers().map(e => e.getEmail()),
};
console.log(res)
}
  • 如果使用Spreadsheet的容器绑定脚本,则可以使用SpreadsheetApp.getActiveSpreadsheet()而不是SpreadsheetApp.openById(spreadsheetId)

结果:

当运行上述脚本时,将返回以下结果。

{
"owner": "### your email address ###",
"editors": [
"### your email address ###",
"### user's email ###",
"### user's email ###",
],
"viewers": [
"### your email address ###",
"### user's email ###",
"### user's email ###",
]
}

参考文献:

  • getOwner((
  • getEditor((
  • getViewers((

相关内容

最新更新