title | description | labels | material_icon | create_time | update_time |
---|---|---|---|---|---|
Automatically populate a team vacation calendar |
Quickly see when your colleagues are out of the office, with no manual entry required. |
Apps Script, Calendar |
event |
2019-07-11 |
2019-08-19 |
A shared vacation calendar is a great tool for helping your team collaborate; anyone can determine who's out of the office at a glance. However, booking time off is already a chore, and an additional step to update the calendar can be easy to forget.
This solution uses Google Apps Script to automatically populate a shared vacation calendar based on the individual calendars of each person on the team. When someone books time off they just need to remember to add an event to their personal Google Calendar using a keyword like "Vacation" or "Out of office." The script acts behind the scenes, scanning the calendars of all the members in a Google Group and syncing appropriate events to the shared calendar.
Note: This solution only accesses Calendar events that your colleagues have made visible to you via their privacy settings.
- The script runs automatically on a fixed schedule using Apps Script's time-driven triggers.
- The
GroupsApp
service is used to determine the members of the team's Google Group. - The Advanced Calendar Service provides access to the Calendar API and the ability to search for events on your colleague's calendar.
First, set up Google Calendar:
- Open Google Calendar in your browser.
- Create a new calendar called "Team Vacations."
- Still in the settings screen, select the new calendar from the left menu.
- Scroll to Integrate calendar and copy the value under Calendar ID.
Next, create the Apps Script project:
- Open the Apps Script project in your browser.
- Click the menu item File > Make a copy....
- Set the variable
TEAM_CALENDAR_ID
to the ID of the calendar you created earlier. - Set the variable
GROUP_EMAIL
to the email address of a Google Group containing your team members.
Then run the script:
- Click the Select function dropdown and select setup.
- Click the Run button (►).
- When prompted, click the Review permissions button.
- Select your Google Workspace account from the list.
- Click the Allow button.
When complete, return to Google Calendar to see the Team Vacations calendar populated with events. For a more detailed record of what the script did, you can view the logs by clicking View > Stackdriver Logging and then Apps Script Dashboard.
To get started with Google Apps Script, try out the codelab which guides you through the creation of your first script.
You can also view the full source code of this solution on GitHub to learn more about how it was built.