1. It scans your calendar event descriptions for the#autoReplyOn tag and sets your out-of-office.
  2. It scans your personal calendar for "Approved Leave" events and adds or removes them from the YTU Staff calendar accordingly.
  3. It scans your calendar for new "Approved Leave" events and adds the #autoReplyOn tag to these.

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 york.ac.uk accounts to access (though it should be noted that this adds information to the "YTU Staff" calendar specifically). 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, open a new Apps Script window  and press the "+New project" button:

  4. Rename the project by clicking on the "Unititled project" text and entering "YTU AutoReply" (or something to your liking):
  5. Rename the "Code.gs" file to "main" (the .gs will get added automatically):

  6. Add three more Script files using the plus button beside Files, called:

  7. Delete the boilerplate code from each of those four files (so they are blank):

    function myFunction() {

  8. Copy all of the code in the original link window (step 1.), from each of its files (Ctrl+A, Ctrl+C), into the respective files in your new project window (Ctrl+V). Press the Save button (floppy disk) for each, and ensure the yellow circle beside the file name has disappeared!
  9. Now you want to enable two Google services. Click the plus button beside Services:

  10. Scroll to find "Gmail API", click and then press the Add button:

  11.  Repeat steps 9 & 10, but this time scrolling to find, and adding, the "Google Calendar API".
  12.  Click on your "main.gs" file and press the Run button (highlighted in green):

  13. On this first execution you will be prompted to grant permissions to this new project: 

  14. Click "Review Permissions"
  15. A new window will open asking for a  Google Login:

  16. Choose your york.ac.uk account
  17. It will inform you what the project will get access to. Press the Allow button:

  18. This will grant access for the project and it should run for the first time. You will see various statements print out in the Execution log:

  19. We're almost done! We do, however, need to set up a Trigger for it to run automatically. On the far left-hand side of your window, press the clock symbol (highlighted green):

  20.  On the far bottom, right-hand side of this new screen, press the big blue "+Add Trigger" button:

  21. Select these exact settings options and press save:

  22. Close your Apps Script tab (and the one you copied all the code from earlier).          
  23. You're finished. Any leave you have booked will get automatically added to the YTU Staff calendar. You can check this tomorrow morning. If something's not working, you will receive an error email from google. If this happens, or you don't think your autoreply is working right, get in touch with ytu-techsupport-group@york.ac.uk and we'll help fix it.

Tip - you can always add #autoReplyOn to the description of any google calendar event where you want AutoReply to be automatically triggered.