Opens a calendar by its ID.
class CalendarApp method .getCalendarById()
CalendarApp is the Apps Script service.
.getCalendarById() is the method name you will see after a dot in your code.
What it does
Why it's used
- Write to a shared team or resource calendar by ID.
- Separate personal events from a company booking calendar.
Common errors
- Forgetting parentheses on getCalendarById. Write CalendarApp.getCalendarById(), not CalendarApp.getCalendarById or getCalendarById by itself.
- Skipping dots between chained calls. Each step needs a dot, like CalendarApp.getCalendarById().
- Adding spaces where they do not belong. Write CalendarApp.getCalendarById(), not CalendarApp .getCalendarById(), CalendarApp.getCalendarById (), or CalendarApp . getCalendarById().
- Wrong capitalization. Use CalendarApp and getCalendarById, not calendarapp or getcalendarbyid.
Explore
Related methods
-
.getEventsForDay()
Returns all events on a specific date.
-
.getDefaultCalendar()
Returns the user's primary Google Calendar.
-
.getEvents()
Returns events in a calendar between two dates.
-
.createEvent()
Adds a timed event to a calendar.
-
.createAllDayEvent()
Adds an all-day event to a calendar.
More Apps Script
Better Sheets tutorials
No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.
Related blog posts
Written guides about CalendarApp.getCalendarById().