It scans your calendar event descriptions for the#autoReplyOn tag and sets your out-of-office.

Caveat emptor 

  1. As of 05-03-2020 - even if you're only out-of-office for three hours AutoReply will still produce a message saying you're back the next day (not saying you're back in three hours).
  2. You can still turn your out-of-office on whenever you like, manually.
  3. Your out-of-office subject will be set to: Out of office until {date}
  4. Your out-of-office messages will include the message you already have set and append the line I am out of the office until {date} to the top. It will also update this line when necessary with a different date.
  5. Weekends are worked out by AutoReply. If you holiday ends on Friday, AutoReply will say you're back on Monday. If you work weekends you'll need to add the tag #autoreplyIWorkWeekends in the event description, to override this feature.


  1. It lives here (right click, Open link in new tab):

     and is available for people with accounts to access. Open this link in a new window.

  2. The University's advice is to make your own copy of this code.
  3. To do this go to File> New > Project
  4. Delete this existing code from the window

    function myFunction() {
  5. Copy all of the code from AutoReply and paste it in your new project.
  6. In the top left-hand corner, rename the project from Untitled project to AutoReply
  7. Resources > Advanced Google Services  (Here, it might ask you to accept Google Services Permissions).
     Switch Calendar API and Gmail API on.

  8.   >> 
  9. Then press 
  10. You might see this: 
  11. Press 
  12.  Choose your account
  13. Click Advanced

  14. Review permissions, if happy, press 
  15. .

  16. Go to:
  17. Over on far right of the project AutoReply (which you've just created) go to options 
  18.  Initially make your trigger look exactly like this, below:
  19.   //Go to your calendar and add an event for today
  20.  Make Add Title  = Test Holiday  //or any name you like
  21. Put #autoreplyOn as text in Description.
  22. Wait just over 1 minute
  23.  // Refresh your Inbox and it should have worked. 

    // We're now going to change the trigger, so the script runs just once a day,  by adjusting the trigger we just made.

  25. // or any time of day - it doesn't matter - sometime before you normally get to work.
  26. Don't forget to delete the test event on your calendar.

Finished - always add #autoReplyOn to the description of any event where you want AutoReply to be automatically triggered.