Skip to content

Instantly share code, notes, and snippets.

@ssato
Created February 25, 2021 10:41
Show Gist options
  • Save ssato/b55b5babec7cbb6212a3ef29100af4fe to your computer and use it in GitHub Desktop.
Save ssato/b55b5babec7cbb6212a3ef29100af4fe to your computer and use it in GitHub Desktop.
force_set_perm_of_files_in_google_drive
/*
*
* https://developers.google.com/apps-script/reference/drive/access
* https://developers.google.com/apps-script/reference/drive/permission
*/
function make_folder_readonly () {
const fid = "xxxxxxxxxxxxxx";
const folder = DriveApp.getFolderById(fid);
const files = folder.getFiles();
while (files.hasNext()) {
var file = files.next();
file.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
console.log(file.getName());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment