Want a full overview and a possibility to take an action on your shared files? Book a 30-day trial here



How to know if you need to take action on file permissions and sharing settings in Google Drive

You've probably been wondering how and if you can have an overview of who has access to which file from your Google Drive. The answer is yes, and in this post, we’ll show you how with Google Apps Script.

Google Apps Script is a flexible, JavaScript-based scripting language built into Google Workspace apps (Docs, Sheets, Slides, Forms, etc.) that lets you create add-ons and automate tasks in those Workspace apps. It runs on Google’s servers, so you don’t need to install anything and you can just code in any browser.

We will be using a script made by Amit Agarwal who is a Google Developer Expert for Google Workspace and Google Apps Script; the script uses the DriveApp service to fetch all the files from your Google Drive and sends an email report with the sharing access and permissions to the Google account that authorized the action.

Disclaimer: Please note that the script requires access to your Google Account. You are free to decide if you want to try running the script to see your personal sharings; however, when it comes to work-related accounts, we recommend consulting with your IT department or security team beforehand.

Setting it up - how to build the script

Step 1. Sign in to the Google Account you want to check the file permissions

Step 2. Go to script.google.com to open the script editor

Step 3. Click on “New Project”

step 3 copy 2.png

Step 4. Delete any code left in the script editor

Step 5. Go to https://www.labnol.org/code/19538-file-sharing-permissions and copy the code from there

step 5-1.gif

Step 6. Return to the script editor and paste the code into the script editor

step 6.gif

Step 7. At the top left, click “Save”

Screenshot 2021-05-03 at 17.37.03.png

Step 8. At the top left, click “Untitled project”

Screenshot 2021-05-03 at 17.39.47.png

Step 9. Type in “File permissions and sharing settings“ and click “Rename”

Screenshot 2021-05-03 at 17.40.57.png

Trying it out - how to run the script

Step 10. At the top left, click “Run”

Screenshot 2021-05-03 at 17.42.33.png

Step 11. Click on “Review permissions” and then click “Allow”

step 11.gif

Step 12. After the script finishes running, go to your Gmail inbox and take a look at the file-sharing report that you just received

step 12.gif


Note: Running this script has some limitations meaning that if you have many files or sharings, the script is limited in the execution time and size of the report, so in general it is not very useful in larger organizations.

Want a full overview and a possibility to take an action on your shared files? Book a 30-day trial here