Populate a team vacation calendar

Coding level: Beginner
Duration: 15 min
Project type: Automation with a time-based trigger

About this solution

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. This solution lets you see when your colleagues are out of the office, with no manual entry required.

vacation calendar example

How it works

This solution populates a shared vacation calendar based on the individual calendars of each person in a Google Group. When someone books time off, they add an event to their personal Google Calendar using a keyword like "Vacation" or "Out of office."

Every hour, the script scans the calendars of the members in a Google Group and syncs appropriate events to the shared calendar. You can change how often the script scans for new events.

Apps Script services

This solution uses the following services:

Before you begin

To use this sample, you need the following prerequisites:

  • A Google Workspace account (you might need administrator approval)
  • A web browser with access to the internet

Try it

Step 1: Set up Google Calendar

  1. Open Google Calendar.
  2. Create a new calendar called "Team Vacations."
  3. In the calendar's settings, under Integrate calendar, copy the Calendar ID.

Step 2: Make a copy of the sample script

  1. Click the button below to open the Vacation Calendar Apps Script project.
    Open the project
  2. Click Overview .
  3. At the top-right, click Make a copy The icon for making a copy.
  4. Set the variable TEAM_CALENDAR_ID to the ID of the calendar you created earlier.
  5. Set the variable GROUP_EMAIL to the email address of a Google Group containing your team members.

Step 3: Populate the calendar

  1. In the function dropdown, select setup.
  2. Click Run.
  3. When prompted, click Review permissions and authorize the script.
  4. When complete, return to Google Calendar to confirm the Team Vacations calendar is populated with events.

Review the code

The sample script's code includes in-line comments to help you understand how it works. To access the code, open the Apps Script project and click Editor .

Modifications

You can edit the team vacation calendar automation as much as you'd like to fit your needs. Below is an optional change to modify the trigger.

Change how often the script scans for new events

To change how often the script runs, take the following steps:

  1. In the Apps Script project, click Triggers .
  2. Next to the trigger, click Edit Trigger .
  3. Select your changes and click Save.

Contributors

This sample is maintained by Google with the help of Google Developer Experts.