Tuesday 24 September 2024

Append Drive file permissions Tool

The following Google Apps Script tool allows you to quickly append new permissions to existing files within Google/Shared drive. This is quite a niche tool so it is anticipated you would already have a Google Sheet of file IDs/URLs, though there is the option to select an existing Drive folder of files and automatically bring them into this tool.

By inserting email addresses using a comma-and-space format you can optionally select to send a notification email to the new user(s).

You can continue to append further rows to the Google Sheet as existing ones will be skipped once the ‘Status’ column has automatically been marked as ‘Completed’. Alternatively you can clear the Sheet each time for a fresh start.

Quickly append new file permissions via a Google Sheet
Quickly append new file permissions via a Google Sheet

Instructions

  1. Open the relevant Google Sheet file and then go to “File” and select “Make a copy”, then choose a suitable location. This will make a copy of the tool in your own Google/Shared Drive.

  2. Start to complete the relevant columns in the Google Sheet. You do not need to add all files at this point but you should ensure you complete the required information for any rows that you do start.

    • File ID or URL - required, unless using the 'Select a folder of files' option from the ‘Admin’ menu. Do not convert to a Smart Chip.

    • File Name - unless using the ‘Select a folder of files’ option from the ‘Admin’ menu, please use the ‘Get file names’ option to scan through your existing IDs/URLs and automatically populate their name.

    • Editor | Commenter | Viewer - optional. It is possible to enter more than one email address here, as long as you separate each one by a comma and a space. For example: john.smith@york.ac.uk, jane.doe@york.ac.uk, joe.bloggs@york.ac.uk

    • Send Email Notification - optional - defaults to ‘No’ if left blank. Uses the standard automated Google email for when an item is shared.

    • Status - will be updated automatically.

    • Notes - optional - just a column for you if you wish to add some information.

    • If you wish to append further Columns from ‘I’ onwards then you may.

  3. Select a folder of files - use this option if you do not have an existing list of file IDs/URLs from another Google Sheet to paste in. This will allow you to collate a Google Drive folder of files (they must be all at one level i.e. the tool will not iterate through sub-folders of files).

    • Click the ‘Admin’ option from the menu bar at the top and then ‘Select a folder of files’. Read the information in the dialogue box carefully and click ‘Yes’ to proceed.

    • Search for your Google Drive folder by entering its name into the search bar at the top left. Click once to highlight it then click the ‘Select’ button. Be patient at this point as there may be a delay whilst all of your files are collated into the Google Sheet and the pop-up remains on-screen.

    • You can now complete the information in the Google Sheet as per Step 2 above, ignoring columns A and B.

  4. Append file permissions.

    • Once you have completed the Google Sheet click the ‘Admin’ option from the menu bar at the top and then ‘Append file permissions’.

    • This will now automatically loop through each row and append permissions. The ‘Status’ column will be updated for you. This column also serves as a way of skipping rows should you wish to append further files in future - so unless it is blank the said row will be ignored. Whilst this is running please leave the Google Sheet open, but you can continue to work on other tasks should you wish. The process will not slow down your PC or internet connection.

    • A pop-up message will appear in the Google Sheet at the end to inform you when it has completed.

Caveats

  • Fixed columns/rows
    • You must not add/delete/move any of the blue columns (A to H) otherwise the tool will break. Nor should you try to insert a new row above the current row 3. You absolutely can add further columns/data from I onwards if you wish.

  • Smart Chips
    • Do not accept the automated Google prompt to convert your File URLs (Column A) into a Smart Chip (this is usually by clicking on the prompt or by pressing the Tab key). Whilst this is useful and looks nicer in other circumstances, it will break the automation here unfortunately as Google have not made Apps Script compatible with them.



Download

Append Drive file permissions Tool download (please use 'File' > 'Make a copy' for your own version).


No comments:

Post a Comment