Consider you are a teacher working on assignment question paper which you have created in Google Docs and shared with your students. You want to automatically send out notification whenever you edit the document Or say you’re a Project manager working with your associates to prepare a presentation and wants to be informed when updates are made.
Google Docs does have notification feature but it’s supported only in spreadsheets. But what when you want this feature in a Google Document, Slides, Form or Drawing?
You can use add-ons/extensions to monitor file changes but they are browser restricted and you should be physically available before the system to get notified of changes. Privacy is another big concern. How about creating our very own solution with Google Script?
How To Get Email Notification When Any Google Document is Modified?
Meet Google Doc Monitor script which will help you monitor literally any file in your Google Drive account and send automatic email notifications to any recipients you want whenever it’s edited or updated.
Let’s get started.
1. Finding ID of File you Want to Monitor
- Log in to your Google Doc account.
- Open the file you wish to track for updates.
- From address bar note down the unique ID of the file.
Example URL: https://docs.google.com/document/d/1GE8N1Jv-eDquicjb5DrnO91SkNVY-Or1M0DKb_UZQtc/edit
File ID: 1GE8N1Jv-eDquicjb5DrnO91SkNVY-Or1M0DKb_UZQtc
2. Installing the Script
- Click here to open Google Doc Monitor Script (Version 2). Next select File-> Make a copy
- Select Tools-> Script Editor. Then Resources-> Advanced Google Services. Scroll down and toggle Drive API to on. Click on the Google Developers Console link on the bottom. Select Drive API under Google Apps APIs. Press Enable API. Close the page. Finally click OK from the previous pop-up.
- Now configurations are all done. Go back to the sheet and select Google Doc Monitor menu-> Authorize. Click continue and then Accept. This is an one time activity.
- Copy, paste the File ID which you noted down previously in cell C6.
- Enter email id of recipients to whom update notifications should be sent in cell C8. You can enter multiple id’s separated by comma.
- Select Google Doc Monitor menu-> Initialize
- Finally select Google Doc Monitor menu-> Start Monitoring
Note: By default alerts will be sent to all editors of the documents. If you don’t want to send to any additional people other than editors just leave the cell C6 blank.
That’s it. Here on the concerned file will be monitored for any changes or updates and notifications will be sent as and when it happens. Polling is done once per hour.
Note: You can close the sheet once setup is done, monitoring will be done behind the scenes.
So did it work for you? Drop in if you have any queries or feedback’s.
Hello,
Thats really a great thing which i was looking for a long time.
But could you please tell me whether it can be applier for monitoring the folders, sub-folders and its file contents also ? or it is only possible to monitor the direct files ?
Thanks in advances
@NAVEEN
Have mentioned it under bonus tip: http://techawakening.org/get-notification-when-any-google-document-edited/3055/#foldermonitor
Hi, I tried the bonus tip to be able to monitor folders in google drive, but I keep getting an error “ReferenceError: “DocsList” is not defined.” Is there something I can do to fix this?
Thank you so much for your awesome help!
Thanks. You can leave a comment on that blog asking them to update. If you wish, I fix that for you. Drop an email to admin@techawakening.org.
This link leads to a script, but no instructions on what to do with it. I’m a little…challenged. What do I do with that script?
I’m having trouble with this. At the very end, when I choose “start monitoring,” it gives me the error message “The value you passed to everyMinutes was invalid. It must be either 1, 5, 10, 15 or 30.” How should I proceed?
Shana,
Thanks a lot for notifying this. It’s fixed now. Please use this updated sheet.
thanks!
It appears by authorizing this document it gives access to all of my google documents. Am I reading this incorrectly? Seems like a large privacy concern.
Code is open sourced and contents accessible is only available to you since you are running it in your account. Basically you own the app 🙂
Thanks!
What a great idea! Is there a way to set up notifications for just one editor of the document? Or does it have to be all editors?
Yes possible, please write to admin@techawakening.org for tweaks.
How do I make an adjustment to notify one or two editors of the document using the Google Doc alert? Thanks.
Possible. Please write to admin@techawakening.org.
Seems like you are asking for a LOT of access into our documents when I push the authorization button. Can you tell me specifically what you will have access to if I authorize the script?
There was already a discussion on this before: http://techawakening.org/get-notification-when-any-google-document-edited/3055/#comment-25755
I can’t get it to install.
When I click on “Initialize” it gives me an error:
Sorry! Error ReferenceError: “DocsList” is not defined. Occurred. Report @ http://techawakening.org/?p=3055
Will be fixing it soon.
Getting the same error kidmar mentioned. Would love to try again once that’s fixed.
Actually, I found the fix. Edit the script and go to line 49. Change “DocsList” to “DriveApp” (without the quotes, of course). Save, and go on about your business.
Spoko,
Thanks! Yep that was an easy fix 🙂 But what wasn’t the case with copy Google drive folder structure script. Had to almost rewrite it.
Bummer. Thanks for this script, btw.
Pleasure is mine, do spread the word 🙂
And of-course you can always help me buy a coffee : http://techawakening.org/go/donate
Hi there! Tried your fix but doesn’t work. I get no folder listed when configuration dialogue appears.
Actually, line 49 has comment, not code. So I just find&replace all DocsList items with DriveApp in both pages of the script. Is that wrong?
Thanks for your help!
Please try again, version 2 is out – https://docs.google.com/spreadsheets/d/1j323aJy2u9LinEXRlwRdZSvplB0g5_3_4jy7vMhwpDA/edit?usp=sharing
How often do the notifications come? I loaded this a couple of hours ago and it’s still not sending any notifications when my co-workers make changes on the trigger document.
Updates are sent once per hour. But I believe there was a bug which was preventing updates from being sent out. It’s fixed now. Please make a new copy of the sheet and start over.
Let me know how it turned out.
I’m using your great Google Sheet to get notification of documents changes. However, when I click on Initialize I get the following error:
“Sorry! Error Exception: Access denied: DriveApp. Occurred. Report @ http://techawakening.org/?p=3055”
Thanks
Please make sure you have access to that file. Just give a try with some other file you own.
For me, no errors, everything said it executed successfully. However, i’m not receiving any e-mails from it at all.
Can you please start over with the steps, have just released newer version of the app. You can discard the previous sheet.
Hi,
Will user know what content is edited or he has to browse though the complete document.
Thanks,
Ronak
As of now, he has to browse through.
Hi, Im trying with some docs, but it’s not working for me, no errors, I’m initializing the script, then changing a file, but no notifications received … 🙁 address and file ID verified twice.
Please start over. Just released version 2.
I followed the instructions but my co-workers and I do not receive any email notifications.
Let me retest it and let you know.
How do I turn this off? It has sent me approximately 20 or 30 notices of changes made only one time several weeks ago. It works and works and works! If it only worked once per change, then I’d be stoked.
Thanks so much,
Dave
That’s odd. Am hearing it for the first time. The moment a new updated is made, flag is reset hence updates will not be sent then on. You can always turn off the app by selecting 4. Stop Monitoring.
Anyhow am pushing version 2 of this app, you can try then. Thanks!
I’m not receiving the notifications. Everything sets up fine. No errors, but when I test it I receive nothing.
Hey! Tried the App and it works great! Only glitch is notifications are delayed by more or less 40 mins. I think it has something to do with timezone (maybe?). Notification sent to me indicates files was edited at Jan 04 2016 22:46:19 GMT -0600 (CST). But I edited the files at Jan 05 2016 12:46:00 UTC +0800 (CST). Anyway to address this?
Please update your time zone from Tools-> Script Editor-> File-> Project properties. And do spread the word. Thanks!
Thanks! Will try this ASAP and give you guys feedback!
Just tested and it works perfectly. Got an reasonable delay of 2 mins which I guess accounts for the time it compiles the changes made in the file. Would there be any conflicts if I were to use this script on multiple files?
Thanks again!
Nope. You can create as many new copy of the script and track any number of files you want. And do share the word.
If you really loved our app, buy us a coffee – http://techawakening.org/go/donate 🙂
Yikes! Yeah, it’s rough to think committing multiple copies of files to track multiple documents. Name them “File A monitoring control file”, “File B monitoring control file”, etc.?
Spreadsheets are simple to code for arrays and the like. This stuff belongs in a tabular form, for as many files as one wants.
Time to refactor this thing. 😉
Great tool. Simple and does just what I needed it to do. Thanks.
You’re welcome! And please do spread the word 🙂
Hi, this worked great when I set up a test doc while logged in on my personal Gmail account.
I use shared docs for work though, and we all log into company Google mail accounts via our company’s network. When I create a test file using my work account, I get the error “Sorry! Error Exception: Access denied: DriveApp. Occurred. Report @ http://techawakening.org/?p=3055” when I try to initialize the Google Doc Monitor. I am guessing it’s because I’m logged in using the company credentials. Is there a way to edit the script to get it to work on a corporate network?
Thanks
We’re facing the same issue. It works fine on a personal google drive account, but not on the corporate google drive. No change notifications were ever sent.
Were you able to get this working for you through your corporate account?
Thanks
Thanks so much for this! I was wondering if there is a way to make it so that each recipient only receives one email each time the sheet is updated. Currently each recipient is receiving two email alerts each time the sheet is updated. Thanks again.
never thought it is even possible to get notification if there is edited in doucument. thank for this article.
You’re welcome. Please spread the word!
Hi,
A co-worker and I tried to set up the script. We followed the instructions and neither of us has been getting any notifications. When I ran the script against a spreadsheet, here is the execution output. The URL is correct, but it doesn’t seem to be seeing my updates. I’ve made updates and then ran the script from the script editor, but no notification email is being sent. Can you see the problem? Thanks.
[16-03-24 16:21:36:016 PDT] Starting execution
[16-03-24 16:21:36:028 PDT] SpreadsheetApp.getActiveSheet() [0 seconds]
[16-03-24 16:21:36:029 PDT] SpreadsheetApp.getActiveSpreadsheet() [0 seconds]
[16-03-24 16:21:36:103 PDT] Sheet.getRange([C6]) [0.073 seconds]
[16-03-24 16:21:36:146 PDT] Range.getValue() [0.042 seconds]
[16-03-24 16:21:36:235 PDT] DriveApp.getFileById([1thjW8BVGudsRbyCYJBfMUCOjMfr_WpYTtzfEtlMqahI]) [0.086 seconds]
[16-03-24 16:21:36:315 PDT] File.getEditors() [0.079 seconds]
[16-03-24 16:21:36:315 PDT] File.getUrl() [0 seconds]
[16-03-24 16:21:36:316 PDT] File.getName() [0 seconds]
[16-03-24 16:21:36:318 PDT] Logger.log([DriveUser,DriveUserhttps://docs.google.com/a/google.com/spreadsheets/d/1thjW8BVGudsRbyCYJBfMUCOjMfr_WpYTtzfEtlMqahI/edit?usp=drivesdkAll CR submitters, []]) [0 seconds]
[16-03-24 16:21:36:318 PDT] File.getLastUpdated() [0 seconds]
[16-03-24 16:21:36:319 PDT] PropertiesService.getUserProperties() [0 seconds]
[16-03-24 16:21:36:336 PDT] Properties.getProperty([timeStamp]) [0.016 seconds]
[16-03-24 16:21:36:341 PDT] Logger.log([Thu Mar 24 2016 18:20:14 GMT-0500 (CDT) null, []]) [0 seconds]
[16-03-24 16:21:36:342 PDT] Execution succeeded [0.194 seconds total runtime]
Can you please share the actual code snippet instead of the log.
Hi,
I’m following up on my previous post where I was not getting notifications. I put in some log entries and find that the line:
var previousTimeStamp = userProperties.getProperty(‘timeStamp’);
always returns null, so the if statement below is not going to get executed:
if (previousTimeStamp) {
if (Date.parse(currentTimeStamp) > Date.parse(previousTimeStamp)) {
Do you know why previousTimeStamp is always returning null? Thank you.
Nice and handy script. Thanks a lot.
Welcome. Do spread the word!
Hello, when I hit Initialize, I get this error: Sorry! Error Exception: No item with the given ID could be found, or you do not have permission to access it. Occurred. Report @ http://techawakening.org/?p=3055
The ID Is definitely correct and I have editing rights on the document.
How long does it take for the notification email to come through? I’ve followed all steps correctly and still haven’t received any notification by email.
Thanks,
This has been working well up until recently it just stopped. I think something changed on the google side. Can you help me to troubleshoot the why.
Bonus Tip: How to Monitor for Folder Changes in Google Drive? The link is currently down
Thank you so much for sharing this knowledge it could be helpful for us
Regards
Anubhav
Hi,
I would like to know how I could do to send notifications only to the mail filled in the sheet and not to all editors of the documents.
Thank you very much.
Please write to admin@techawakening.org for tweaks. Thanks.
Great Article. article , I am thankful for the facts ! Does anyone know if my assistant might find a blank a form form to complete ?
Great thing, one question – is it possible to change notification period.
like this?
ScriptApp.newTrigger(“montiorFile”).timeBased().everyMinutes(1).create();
Will your script send notifications of multiple docs?
If it does, where to I paste the doc ids?
Thanks for a great script!
Brain,
As of now app supports only one file tracking per sheet. To track multiple files, you have to create multiple copy of the sheet.
THIS.WAS.AWESOME.
Oops, there was a typo in my previous post’s email address.
Is it possible to change the email’s ‘From’ address to something that won’t get a reply, like say, ‘norelpy@mydomain.com’?
Thank you so much for this, by the way. It’s almost perfect apart from getting unwanted replies to my gmail despite telling everyone it’s just for notifications and they shouldn’t reply to it.
All emails usually originate from your Gmail ID 😐
Seems the link under “bonus tip” is broken. Could you check this? Thanks!!
Updated.
Cool tool!
Question: When I go to Authorize, I get the alert message:
Techawakening.org needs your permission to access your data on Google.
Does this mean that you will actually have permission to access my data?
Is there a way to change this to replace Techawakening.org with my user name?
Note: I’m not trying to avoid giving you credit… just don’t want the code to have permission to access my files.
Many thanks,
Mo
No. It’s just the name for copyright purpose. The app is completely managed by you. We don’t have any access to your data.
Hi!
How can I test the app?
I was waiting for the last two hours and received no notification after the document was modified.
Thank you.
I second your comment Gabriel — thanks.
In contrast to what is suggested in the instructions above (under heading “2. Installing the Script”, “Click on the Google Developers Console link on the bottom”), at that step I didn’t see a “Google Developers Console link” but *did* see a “Google API Console” link and therefore clicked that one.
From that point onwards I notice(d) multiple differences with what is suggested in the instructions above: in the resulting view, I couldn’t find (a link/heading?) “Google apps API’s”, and therefore pressed the button “API’S EN SERVICES INSCHAKELEN” [in my (Dutch) version of Google Chrome “Version 60.0.3112.101 (Official Build) (64-bit)”] instead. In the resulting view, “Drive API” was listed under “G Suite API’s”. After “[s]elect”ing “Drive API” there indeed, in the resulting view I wasn’t sure whether I’d still have to change something there — I pressed the “OK” button as well indeed. Then I continued to try and adhere to the instructions above as much as possible, but like Gabriel I haven’t received notifications of Doc updates.
I am wondering whether I would need to obtain certain ‘additional’ rights still, e.g. by obtaining a “Google Developers” [account?] indeed, and/or/a.k.a. register for the “Google Cloud Platform”…?
H.
Hi there,
I do not have edit permission on a document but I do have viewing access to it. I have installed and activated the script and so far there seems to be no problems (errors etc.).
Obviously I won’t know if this works properly until the actual editor makes a change, but I thought it would be a good idea to check if anyone else has tried this and whether they’ve gotten emails when updates were made?
Basically, I have set up this script on a document I do NOT own, and that i do NOT have edit permission on so… Will it still work?
Does this still work? I do not get notifications.
Gan,
We don’t have any access to your data. It’s accessible only to you.
I am getting the following error…
“Sorry! Error Exception: We’re sorry, a server error occurred. Please wait a bit and try again. Occurred. Report @ http://techawakening.org/?p=3055”
Still working?, I´ve done all the process and it is succesful, but I don´t get notifications
Still working?, I´ve done all the process succesfully but I don´t get notifications
thanks for the process!
question.. can you make it so that you get an email right after you make the edit to the doc? Or, like 1 minute instead of 1 hour?
thanks!
Is there a way to be notified at 1 minute instead of an hour?
How would the code need to be edited?
Thanks!