This script provides functions for managing files and folders in Google Drive and shared drives. Each function is described here, the three sheets used and how to get started.
- Copy the Google Sheet document here.
- Functions run via the File Management menu in Google Sheet.
- Select the desired function from the menu.
- Since it is the first time you run the script, you will need to authenticate with the Google Workspace account you connected it to. This is only done the first time
- All actions are logged in the "Log" sheet.
- Check "Folder file list activity" for reports and marked files.
To act on files and folders as well as shared drives, the account running the script must have access to these.
- Stores source and destination information for folders and shared drives.
- Columns and cells:
- A2: ID of source folder.
- E2: ID of destination folder.
- G2: ID of the source shared device.
- H2: ID of the destination shared drive.
- B column: Prefix to be removed or added.
- Column C: Email addresses of users to be added or removed.
- D-column: Authorization levels ("reader" or "writer").
- I2: Max number of files to list (for function 11).
- Automatically created by the script if it doesn't already exist.
- Logs actions performed by the script, including file moves, prefix changes, and permission updates.
- Used to generate reports and manage file activities.
- Columns:
- The path of the file.
- File ID.
- Last modified.
- Creation date.
- Shared users.
- Mark for deletion ("Y", "y", "Yes", "yes").
- Moves files that start with certain prefixes from a source folder to a destination folder.
- Expected result: The files are moved and logged in the "Log" sheet.
- Removes specified prefixes from file names and moves them to a subfolder "renamed files".
- Expected result: Files are renamed and moved to "renamed files".
- Adds a prefix to file names in a specified folder.
- Expected result: Files are given a new prefix and the change is logged.
- Removes sharing permissions for specified users.
- Expected result: Permissions are removed and logged.
- Adds specified users with specified permission levels ("reader" or "writer").
- Expected result: Users are added with the correct permissions.
- Moves all files and folders, including subfolders, from a source folder to a destination folder, preserving the folder structure.
- Expected result: All files and folders are moved to the destination and logged.
- Creates a report of all files in a specified folder, including metadata such as file ID, last modified, and shared users.
- Expected result**: Report is generated in "Folder file list activity".
- Deletes files that are selected in column F of "Folder file list activity" ("Y", "y", "Yes", "yes").
- Expected result: Selected files are deleted and logged.
- Generates a list of all files and folders on a specified shared drive.
- Expected result: List is generated in "Folder file list activity".
- Copies files and folders from one shared drive to another and replicates sharing permissions. The originals are deleted after copying.
- Expected result: Files are moved between drives and the originals are deleted.
- Generates a report of all files owned by the account, with a limit on the number of files specified in "Folder Data".
- Expected result: Report is generated in "Folder file list activity".