Set a GDrive folder to auto expire sharing priveliges

This is an amazing thing, and I am going to copy almost the entire post from Digital Inspirations here. This is one of those wonderful things that you need occasionally, and when you need it, you really need it. But all those other times, the knowledge just sits there and annoys you that it is taking up space in your brain, but you know the second you forget, BAM, you need it.

Which is why I am putting it here in my own blog. Let’s say you are collaborating with some teachers on a new curriculum idea, and you know that in 6 months when the deadline hits, no one will ever need the working docs because the finished docs will be released and that is all that matters.

It would be great to have the shared folder disappear from everyone’s Google Drive automatically. Well, thanks to Digital Inspirations, here is how you do it.

Set Expiration Dates & Temporarily Share Google Drive Folders

You create a folder in Google Drive and share it with Public or a small group. You then specify a date/time when you want that shared link to expire. The script, at the specified time, will create a copy of your shared folder and delete the original one. Thus the shared links would no longer work though the folder and files will stay in your Google Drive.

Let’s get this to work now.

  1. Open the Google Script and then choose File -> Make a Copy to copy this script into your Google Drive.
  2. Add the URL of your shared Google Drive folder and the expiration date in the script (use the YYYY-MM-DD HH:MM format).
  3. Go to Run -> Initialize and grant the necessary permissions.
  4. Go to Run -> Start and it will create a trigger that will auto-expire the shared links at the specified time.

That’s it. You can exit the Google Script page and it will send you an email notification when the shared links are disabled.

The Google script can be used for setting expiry dates against shared folders only but not for individual files due to certain limitations in Google Apps Script. Thus, in case you wish to auto-expire an individual file, just put in a new folder and share that entire folder.  — via

The Google Script in step 1 is a public script written by Digital Inspirations. You make a copy of the script, then copy paste one web URL from the shared folder into the document and insert the date.

Done. That is all it takes.

It doesn’t really revoke any sharing privileges, it circumvents them by copying the folder into a new, non-shared folder, and then deletes the original. Same effect though.

I can see this being useful for those certain projects we do. Maybe not all the time, but there are uses for sure.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top