Returns the user's primary Google Calendar.
class CalendarApp method .getDefaultCalendar()
CalendarApp is the Apps Script service.
.getDefaultCalendar() is the method name you will see after a dot in your code.
What it does
Why it's used
- Add events to the user's main calendar without extra setup.
- Most scheduling scripts start here.
Common errors
- Forgetting parentheses on getDefaultCalendar. Write CalendarApp.getDefaultCalendar(), not CalendarApp.getDefaultCalendar or getDefaultCalendar by itself.
- Skipping dots between chained calls. Each step needs a dot, like CalendarApp.getDefaultCalendar().
- Adding spaces where they do not belong. Write CalendarApp.getDefaultCalendar(), not CalendarApp .getDefaultCalendar(), CalendarApp.getDefaultCalendar (), or CalendarApp . getDefaultCalendar().
- Wrong capitalization. Use CalendarApp and getDefaultCalendar, not calendarapp or getdefaultcalendar.
Explore
Related methods
-
.getCalendarById()
Opens a calendar by its ID.
-
.getEventsForDay()
Returns all events on a specific date.
-
.getEvents()
Returns events in a calendar between two dates.
-
.createAllDayEvent()
Adds an all-day event to a calendar.
-
.createEvent()
Adds a timed 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.getDefaultCalendar().
Google Sheets Calendar vs Google Calendar: When to Use Each
A Google Sheets calendar shows the whole year, prints, and takes notes. Google Calendar sends reminders. Here is when to use each, and how to run both.
Read post →Spreadsheet Calendar: Google Sheets vs Excel vs Paper
Why a spreadsheet calendar works for planning a year, and how Google Sheets, Excel and a paper wall calendar compare for editing, sharing and printing.
Read post →Google Calendar Year View: How to Turn It On and Its Limits
How to switch Google Calendar to year view on a computer, why you can't print it, and a free one-page 2027 year in Google Sheets to keep beside it.
Read post →