// Calendar · Apps Script

Add a guest to a calendar event in Google Calendar.

How to add a guest to an existing Google Calendar event using Apps Script, with control over whether an invite email gets sent.

I need to programmatically add one or more guests to an existing Google Calendar event without manually editing each event in the UI.

The script

copy · paste · trigger
addGuest.gs
Apps Script
// Add a guest to a specific calendar event by event ID
// Fetches the event from the primary calendar and adds one guest.
// Set sendInvites to false to update silently (no email sent).

function addGuestToEvent() {
  var calendarId  = 'primary';
  var eventId     = 'abc123xyz_eventIdFromCalendarAPI';
  var guestEmail  = 'guest@example.com';
  var sendInvites = false;

  var calendar = CalendarApp.getCalendarById(calendarId);
  var event    = calendar.getEventById(eventId);

  if (!event) {
    Logger.log('Event not found: ' + eventId);
    return;
  }

  event.addGuest(guestEmail);
  Logger.log('Guest added: ' + guestEmail);
}

Need a variant? Gnaw writes a custom version from one sentence — fields, triggers, edge cases handled.

Walkthrough

Getting the event ID

Every Google Calendar event has an opaque ID — the string that looks like `abc123xyz@google.com` in the Calendar API, or a shorter variant when accessed through Apps Script. The fastest way to grab it during development is to open the event in Google Calendar, click the three-dot menu, and copy the event link. The ID is the long alphanumeric segment after `eid=`, URL-decoded. In a real script you more often get it by querying events in a date range with `calendar.getEvents(startDate, endDate)` and iterating, then calling `event.getId()` on each one to match by title or other metadata.

One gotcha worth naming: `getEventById` expects the Apps Script event ID, not the raw iCalUID from the Calendar REST API. If you are mixing the two APIs, the formats differ and you will get null back even when the event exists. I hit this the first time I tried to cross-reference a Sheets column full of API-sourced IDs against CalendarApp — had to strip the `@google.com` suffix and still got mismatches until I queried by date range instead.

What addGuest actually does to notification state

Calling `event.addGuest(email)` adds the address to the event's guest list and, by default, queues an invite email to that address. That default comes from the CalendarApp service's built-in behavior, which mirrors what happens when you manually add a guest in the UI.

If you want a silent update — adding someone to the attendee list without triggering a notification — the CalendarApp service does not expose a per-call `sendUpdates` parameter the way the Calendar REST API does. Your options are: accept the invite email and inform the guest it is coming, or switch to the advanced Calendar API (enabled under Services in the Apps Script editor) and call `Calendar.Events.patch` with `sendUpdates: 'none'`. The REST API path is more code but gives you full control. For most internal tooling where the guest expects the invite, `addGuest` alone is fine.

Bulk-adding guests from a Sheets column

The pattern that comes up most in practice is reading a list of emails from a spreadsheet and adding each one to an event. The loop is straightforward: call `SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Guests').getDataRange().getValues()` to get a 2D array, iterate rows, and call `event.addGuest(row[0])` for each non-empty cell.

Two things to watch here. First, Apps Script quota: `addGuest` triggers a Calendar write per call, and the free tier caps calendar writes at 10,000 per day across all scripts in your Google account — not per script. If you are bulk-processing hundreds of events with dozens of guests each, you will exhaust that quota faster than you expect. Second, `addGuest` is idempotent for a given email on a given event; calling it twice does not create a duplicate attendee, so retrying a failed run is safe.

Want a custom version?

Describe your sheet and the rule you want. Gnaw writes the Apps Script — fields, triggers, edge cases — in one shot.

FAQ

4 questions
Does addGuest send an invite email automatically?
Yes. The CalendarApp service sends an invite by default when you call addGuest. To suppress it, you need to use the Calendar REST API via the advanced service and set sendUpdates to 'none'.
How do I find the event ID to pass to getEventById?
Query the calendar with getEvents(startDate, endDate), iterate the results, and call getId() on the CalendarEvent object you want. The ID you get back is the correct format for getEventById. IDs from the Calendar REST API include an '@google.com' suffix that Apps Script does not use.
Can I add multiple guests at once, or do I have to loop?
You have to loop. addGuest takes one email address per call. There is no batch variant in CalendarApp. If you need to add a large list, iterate and call addGuest for each address — it is idempotent, so re-running the script on an already-added address does nothing harmful.
What happens if the event ID is wrong or the event is on a calendar I do not own?
getEventById returns null if the event is not found or the script does not have write access to the calendar it lives on. Always null-check before calling addGuest, or you will get a TypeError on the next line rather than a useful error message.