Set Sharing Permissions in Google Drive with Apps Script

You can easily change the sharing and access permissions of any shared file or folder in Google Drive with the help of Google Apps Script.

The following Google Script sets auto-expiration dates for shared links and makes the folder /file “Private” after the expiration date.