Sharing expiry link for external sharing via Drive

95 views
Skip to first unread message

Jes

unread,
Jun 19, 2024, 10:47:16 PM6/19/24
to GMail Power Users
Hi

Since there is no auto-expiry option while sharing a folder with people outside the organisation, what workarounds do we have? This is a security huge issue. 

I checked a Chrome extension, but that does not have good reviews. There could be Google API but I am not a programmer. However, I can give it a shot at tweaking an existing API template.

P.S.> I made or liked a Feature Request for this a few years ago.

Adarsh Kumar

unread,
Jul 21, 2026, 7:34:50 PM (5 days ago) Jul 21
to GMail Power Users
Hello Jes,

I am aware that your query was asked "long-ago", but in case it helps you or others, I am responding now.

I quickly threw together something that works for your use case (as it's also a use case I feel that I will have at some point).

It's a small Google Apps Script with only ~10 lines of code (6, minus the input parameters).

To use it, you must replace the folder ID and user email inputs with your values.

You must also set a trigger to run this script (which is done in the left sidebar as shown in the clip below).

SetTrigger.gif

Adarsh Kumar

unread,
Jul 21, 2026, 7:34:56 PM (5 days ago) Jul 21
to GMail Power Users
Continuing...

The link to the script is here:
https://drive.google.com/open?id=1KnZp8xH9t1H_CnZOPAYzqMNGMxImI5TOZx0psPtSOIaXXCEHWAeOdKws

If you would like to see any improvements to the script, feel free to let me know!

Regards, 
Adarsh R. Kumar
adarshrkumar.dev

Adarsh Kumar

unread,
Jul 21, 2026, 7:34:57 PM (5 days ago) Jul 21
to GMail Power Users
Continuing...

You must then authorize the script to access your Google account before the script can run via a trigger.
But, not sure why, you must run the script manually in order to get authorization for future runs.

To get authorization, input a valid FOLDER_ID, but an invalid (or not shared on the folder) email, so that access !== 'NONE' becomes false.
This means it won't remove someone from the folder until the trigger date (or forever), but it will still require your authorization.

Here is how to perform this:
PermissionsPopup.gif
Reply all
Reply to author
Forward
0 new messages