How to Set Expiration Dates for Shared Google Drive Files
When you share any file or folder in Google Drive with another user, the shared links will work forever unless you manually change the sharing permissions. For instance, if you have shared a document with an external vendor, they’ll continue to have access to the file long after your business contract may have ended.
In such a situation, wouldn’t it be nice if you could set expiration dates while sharing files in Google Drive? For instance, share a document temporarily for, say, 10 days and access to the file should be revoked automatically after that period has passed.
Google Drive does let you set expiration dates for shared links but this option is only available to paid Google App for Work accounts.
Well, no worries. If you have a free Google account, you can still create temporary links that auto-expire after a certain time. Here’s a step by step guide:
- Go to labnol.org/expire and authorize the web app to access your Google Drive.
- Open the File Picker and select any file or folder in your Google Drive that you would like share.
- Enter one or more email addresses (comma separated) of users who should be given viewer (read-only) or editor (read & write) access to your file.
- Finally, specify the time period after which the access should be limited. You can say 5 hours or 3 weeks or even 2 years.
Click the “Set Expiration” button and you are done. The Google Script will set a time-based trigger that will automatically remove the specified user from the access list after the specified date and time.
The auto-expiry app will list all the files and folders that are set to expire after a certain period. You can click the “cancel” link against any Drive link to prevent that shared link from expiring automatically.
Google Developer Expert, Google Cloud Champion
Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.