How to Add Expiration Date For Shared Google Drive Folders

Tired of manually changing access permissions of your Google Drive files? It will be easier to set a cease-sharing date, something like an expiration date for the sharing permission. Beyond this date, the file no longer can be shared with the person you share it to.

By adding this Google Script on your Google Drive, you can set an expiration date to your Google Drive shared files. And all it needs is a script.

Integrating Google Drive

The first step is to make a copy of this script on Google Script. Click on File > Make A Copy.

expiration-shared-g-drive-folder

Under EXPIRY_TIME put in the date (yyyy-mm-dd) and time the folder ceases to be shared. Under FOLDER_URL, change the url path to the folder you want to set an expiration time to.

expiration-shared-g-drive-folder

The folder URL that needs replacing must be the ‘link to share’ of the folder. To obtain the ‘Link to share’ URL, tick the folder you want to share and click on Share.

expiration-shared-g-drive-folder

After doing so, you’ll see the ‘Sharing Settings’ page. Copy the ‘Link to share’ and replaced it in the script.

expiration-shared-g-drive-folder

After all the changes, your script should look something like this.

expiration-shared-g-drive-folder

Next, click on Run > Initialize.

expiration-shared-g-drive-folder

It will ask for permission to access your data, click on Authorize.

expiration-shared-g-drive-folder

After authorizing permission, click on Run > Start, and your folder now has an expiry date. You will receive this notification in an email. Easy isn’t it?

expiration-shared-g-drive-folder

This script only works on Google Drive folder, so if you want to share a single file but with an expiration date, you need to place the file in its own folder. For now you can only set expiration dates for one folder at a time.

WebsiteFacebookTwitterInstagramPinterestLinkedInGoogle+YoutubeRedditDribbbleBehanceGithubCodePenWhatsappEmail