This is a Google App Script to set vacation response in Gmail setting using Calendar's specific event
The setup will trigger this script to run once each day (preferred between 0:00 - 1:00 am) and go through your all day event and find "Vacation" (this is customizable) and set startDate
, endDate
, subject
, body
in the Gmail Vacation Setting.
The following Advanced Google Services need to be enabled before running this script. Please refer to https://developers.google.com/apps-script/guides/services/advanced
- Calendar
- Gmail
- Login to Google drive and create a new App Scriot
- Copy the Code.gs and paste into the new App Script
- On the calendar, book a chunk of all day event, (E.g. "PTO" or any thing you like, but make sure you change here). You can also change the subject and body if the response message.
- To test this standalone script, follow https://developers.google.com/apps-script/guides/standalone and choose
run
ordebug
. - To schedule time trigger go to Resources -> Current project's trigger -> Add a new trigger -> Select to run
main
fucntion -> Time driven -> Set to run once a day from 0:00 am - 1:00 am (or your choice). To install trigger manually follow this link - To verify the result, go to Gmail->Setting, then scroll all the way to the end and verify Vacation responder is turned on with all the other field populated.