-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDriveGAPS.js
More file actions
36 lines (31 loc) · 816 Bytes
/
Copy pathDriveGAPS.js
File metadata and controls
36 lines (31 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const fileId = "your_file_id";
function getUsers() {
const file = DriveApp.getFileById(fileId);
const editors = file.getEditors();
const viewers = file.getViewers();
const userEmails = [];
// Extract emails from editors
if (editors.length > 0) {
editors.forEach(editor => {
const email = editor.getEmail();
if (email) {
userEmails.push(email);
}
});
}
// Extract emails from viewers
if (viewers.length > 0) {
viewers.forEach(viewer => {
const email = viewer.getEmail();
if (email) {
userEmails.push(email);
}
});
}
if (userEmails.length > 0) {
Logger.log("Users with access:");
userEmails.forEach(email => Logger.log(email));
} else {
Logger.log("No editors or viewers found for this file.");
}
}