Monday, May 12, 2014

Google Drive: notify CRUD (created, updated, deleted) files in folders

Google Drive is a good place to store files and share them with your friends or within your company. Google also developed notification mechanism for spreadsheets when changes are made to them. However that isn't enough. Users don't have only spreadsheets , they also have many types of documents. So they very need a tool to notify when these documents are changes. Many users already asked for this feature here. While waiting Google develops this feature, there is a good guy (Marcello Scacchetti from Jelly Bend) contributed a Google Apps Scripts to monitor new or deleted files in folders of Google Drive. It works like Microsoft's SharePoint. You can read and copy his code here.

In this article, I will share my modification on his code to make some additional capacities as below:

  1. Notify updated files
  2. Able to configure list of emails to receive notifications instead of only owner
  3. Able to configure subject and content of notification email for each of notification type (new, updated, deleted)
  4. Able to configure excluded folders (don't send notification if changed files are in these folders).
Before starting, pls copy this spreadsheet - Monitor Changes of Google Drive Folders. It will have a new menu Drive Folder Monitor and content like the following picture:


All things which you can do are:
1. Go to menu Drive Folder Monitor >> Configuration, then add the folders which you want to monitor and select time for interval running at Run drive folder monitor each box. Currently it just supports top level folders. I'll add a new version to support sub folders when I have time. First running, Google may ask you to authorize the script, pls click Accept.
2. Change Email To Inform (cell A2) to emails (separated by commas) which you want to send notifications.
3. Change Email Title of New Documents (cell B2), Email Title of Updated Documents (cell C2), Email Title of New Documents (cell D2) for the subject of each type of notification email.
4. Change Email Body (cell B3, C3, D3) for the content of each type of notification email. Remember don't delete $$FILE$$ string. It will be replaced by folders and files which are changed.
5. Configure Excluded Folders (cell B4), the format of folder is TOP_FOLDER/SUB_FOLDER (slash between folders), folders are separated by commas (,).
6. This tool will run automatically with interval time you set in step 1. In the case of you want to run manually, let click menu Drive Folder Monitor >> Run monitor folder.

Hope you can use this script in your work. Any comment and contribution idea are welcome.
Best regards,
Hung

No comments:

Post a Comment

Subscribe to RSS Feed Follow me on Twitter!