我有一个Google云端硬盘文件夹,里面有30多个Google表格。在每张工作表中,我有5个以上的标签,每个标签至少有一组受保护的单元格或标签本身。我想知道,是否可以将受保护单元的所有这些权限作为文本提供给一个Google表单,以便能够快速查看并可能管理权限。然后,我的长期目标就是直接从该Google表单管理受保护的单元格。我一直在寻找,但还没有找到任何资源让我走上正轨。在Google表格中管理Google受保护的单元格
0
A
回答
1
我所著这个剧本,让您想要的任务,
运行,你需要打开一个电子表格,或ceate一个新的,然后 转到工具 - >脚本编辑器创建脚本它,然后复制/粘贴代码。
更改“#########################”为您的容器文件夹的ID,以确定您的文件夹的ID你可以打开一个文件夹,然后复制对应的ID https://drive.google.com/drive/folders/#########################
的URL部分,你之后添加菜单,你需要刷新才能看到它。
使用方法:点击定制实用程序 - >获取permisions列表这里,那么它会创建“纸#”,将拥有所有的信息
这里是代码:
function onOpen(){
var ui = SpreadsheetApp.getUi();
ui.createMenu('Custom Utilities').addItem('Get permisions list Here','testfunction').addToUi();
}
function testfunction() {
//Add a new sheet in the current Spreadsheet
var activeSheet = SpreadsheetApp.getActiveSpreadsheet().insertSheet().activate();
activeSheet.appendRow(['FileName','ID','Protection Description','Range','Type','Users']);
activeSheet.getRange("A1:F1").setFontWeight('bold');
//get all the Google Spreadsheet's files
var files = DriveApp.getFolderById("#########################").getFilesByType(MimeType.GOOGLE_SHEETS);
while (files.hasNext()) {
var file = files.next();
var ss = SpreadsheetApp.openById(file.getId());
//get the permisions in the current file, and print the data to the previous created sheet
var protectionsRange = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);
for (var i = 0; i < protectionsRange.length; i++) {
var protection = protectionsRange[i];
activeSheet.appendRow([file.getName(),file.getId(),protection.getDescription(),protection.getRange().getA1Notation(),protection.getProtectionType(),protection.getEditors().join(";")]);
//Logger.log(file.getName() + " | " + file.getId() + " \n| " + protection.getDescription() + " | " + protection.getRange().getA1Notation() + " | " + protection.getProtectionType() + " | " + protection.getEditors().join(";"));
}
var protectionsSheet = ss.getProtections(SpreadsheetApp.ProtectionType.SHEET);
for (var i = 0; i < protectionsSheet.length; i++) {
var protection = protectionsSheet[i];
activeSheet.appendRow([file.getName(),file.getId(),protection.getDescription(),protection.getRange().getA1Notation(),protection.getProtectionType(),protection.getEditors().join(";")]);
//Logger.log(file.getName() + " | " + file.getId() + " \n| " + protection.getDescription() + " | " + protection.getRange().getA1Notation() + " | " + protection.getProtectionType() + " | " + protection.getEditors().join(";"));
}
}
}
相关问题
- 1. Google表格保护
- 2. 如何让onEdit函数影响Google表格中受保护的单元格?
- 3. 如何允许受保护的Google表格中的功能?
- 4. Google表格中所需的受限时间戳单元格
- 5. Google表格接受来自邻居单元格的颜色
- 6. 从Google表格中的表中条件格式化单元格
- 7. Google表格跳转到单元格
- 8. Google表格APIv4获取空单元格
- 9. Google表格宏单元格颜色
- 10. 获取Google表格单元格值
- 11. 撰写Google表格单元格
- 12. Google表格脚本 - 删除表格中的选定单元格
- 13. Excel宏将单元格格式更改为受保护表格的文本
- 14. Google电子表格单元格引用合并单元格
- 15. Google表格 - 用重复单元格替换= [单元格]
- 16. Excel服务中的受保护表格
- 17. Google表格在整行和单元格上的条件格式
- 18. Google表格 - 允许用户在受保护的范围上运行脚本
- 19. Google表格脚本 - 在不同单元格中的循环值
- 20. 在Google表格中查找两个相同的单元格
- 21. 在网页中显示Google表格单元格的内容
- 22. Google电子表格,用表格中的单元格检查表格的名称
- 23. 如何在C#的受保护Excel表单中编辑或取消保护单个单元格?
- 24. 使用单元格值在Google文档中着色单元格
- 25. 取消保护单元格
- 26. 在Google表格中随机化单元格
- 27. 如果满足条件,填充单元格 - 在Google表格中
- 28. 在一个单元格中存储Google电子表格数组
- 29. 在Google表格单元格中呈现JSON值
- 30. 在Google电子表格中循环浏览单元格