Auditing Permissions for All Shared Files in Google Drive

8 hours ago 2
index

I was looking for a way to get a list of who has access to all shared files on Google Drive, for security compliance purposes. I found some articles in the internet, but it’s unfortunate that their script is not helpful. They’re either outdated or only works for business accounts.

So, I created my own Google Sheets template with Apps Script attached.
At first, I wanted to publish this on Google Workspace Marketplace, but I learned that drive.readonly is classified as a restricted scope which requires an expensive yet long process of security certification (at least CASA Tier 2).
So, I decided to just share the Apps Script on my Github and provide a tutorial here.

How to Audit Files on Google Drive

  1. Copy my Google Sheets template (it already contains my own Apps Script): Link to Google Sheets Audit Template.
    copy document Click “Make a copy” to get your copy of the template.

  2. So, you have already copied the template with attached apps script. Now, you can use it using the “Drive Audit” menu just as shown in the picture

google drive audit files scriptgoogle drive audit files script

We can try running an audit for the first time, by clicking “Run Audit Now”.

If “Authorization Required” pops up, then you just need to click OK and allow it authorization

Click “Advanced” (the text link in the left bottom) and click “Go to Clasp Drive Audit Add-on (unsafe)”

Verification pops upVerification pops up

Click “Select all” so you allow the permissions and Continue Select all

After that, you can see that the audit has been started

starting auditstarting audit

You will see “Drive Audit” and “Audit Status” Sheets get appended.
You can see all the details in the “Drive Audit” Sheets. I’ve covered the sensitive details with red box

drive auditdrive audit

You can see the audit status if it’s completed or still runing in the “Audit Status” sheets.

Weekly Audit

Besides running the audit on-demand, you can also setup an automated weekly audit with Setup Weekly Schedule menu alt text

How this works

This is an Apps Script that lets you see who has access to all your shared files on Google Drive.
It reads all your shared Google Drive file details (permissions) and list them down into your spreadsheet.
Please note that the process is not instant, it works in batch and may take longer depending on how many shared files you have.

Github

This script is safe because it only runs with read-only Drive permission. You can see the full open-source code on Github

Questions

If you have any questions, feel free to contact me at driveaudit(at)terrydjony.com

Read Entire Article