This Google Apps Script automatically manages guests for events in a specified Google Calendar. I use it to sync all events I'm invited to with my company calendar to my personal calendar, so my free-busy availability is up to date there. It also attempts (I might not have permission) to remove my company calendar from the guest list, so I'm not duplicated on the events.
- Automatically adds a predefined guest to all events within a specified time frame if they're not already included.
- Removes a specific guest from all events within the same time frame if they're currently included.
- Handles recurring events efficiently by processing the entire series rather than individual occurrences, preventing duplicate processing.
- Set up your Google Apps Script project: Copy this script into a new Google Apps Script project linked to your Google Calendar.
- Customize your calendar and guest settings: Replace
hello@example.com
with the ID of the Google Calendar you wish to manage. Update the guest email addresses in the script (guest.to.add@example.com
for adding,guest.to.remove@example.com
for removing) to your desired guests. - Schedule execution (optional): For automated management, set up a calendar chage trigger in the Apps Script editor to run the
onCalendarChange
function.
- Test the script with a few events before scheduling regular runs to ensure it behaves as expected.