Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Google Calendar

Use gog to list calendars and events, read individual events, create events with attendees and reminders, update or delete events, respond to invitations, and check availability. The examples show how time zones affect date ranges, event times, and display.

Read commands need a signed-in account (see Authentication and Accounts). Their expected output is described using the gog v0.48.1 source.

Write commands are shown with their --dry-run --json plans, captured with an empty configuration. The examples use the zone America/Toronto and the placeholder EVENT_ID for an event identifier.

Calendar IDs

Every calendar command names a calendar by its calendar ID. Your main calendar is always available as primary. Other calendars have IDs in the form of an email address, and many commands also accept the calendar’s display name or its position in the output of gog calendar calendars.

gog --account you@example.com calendar calendars
gog --account you@example.com calendar calendars --json --results-only

gog calendar calendars lists the calendars on your calendar list, 100 per page by default, with --page, --all and --fail-empty as usual. The table has the columns ID, NAME and ROLE, where the role is your access level, such as owner or reader. The JSON is {"calendars": [...], "nextPageToken": ...}, and each item is a Calendar API calendar-list entry with fields such as id, summary (the name), timeZone and accessRole (internal/cmd/calendar_list_cmds.go).

Listing events

gog calendar events (aliases list and ls) lists the events of 1 calendar, primary by default. Without any range flag it covers the next 7 days, starting now (internal/cmd/time_helpers.go).

gog --account you@example.com calendar events
gog --account you@example.com calendar events --today
gog --account you@example.com calendar events --tomorrow --json
gog --account you@example.com calendar events --week --week-start sun
gog --account you@example.com calendar events --days 3
gog --account you@example.com calendar events --from 2026-12-01 --to 2026-12-04
gog --account you@example.com calendar events --from 2026-12-01T09:00:00-05:00 --to 2026-12-01T17:00:00-05:00
gog --account you@example.com calendar events --from monday --to "next friday"

Choosing the period

FlagsPeriod
nonefrom now for 7 days
--today, --tomorrowthat whole day
--weekthe current week; --week-start sun (or mon, the default) chooses the first day
--days NN whole days, starting today or at --from
--from X --to Yan explicit period; X and Y can be RFC 3339 times (date, time and UTC offset, such as 2026-12-01T09:00:00-05:00), dates or relative words
--from X alone7 days starting at X

--today, --tomorrow and --week each describe a complete period, so gog rejects 2 of them together, and it rejects their combination with --from, --to or --days. --days and --to both set the end of the period and cannot be combined either.

A date-only --to includes that whole day, so --from 2026-12-01 --to 2026-12-04 covers 4 days. A period whose end is not after its start is a usage error. The accepted time formats are listed in Output, Schemas and Dry Runs.

Time zones in a listing

gog uses time zones for 2 purposes when listing events.

  • Date-range time zone. gog asks Google for the time zone of your primary calendar and interprets --today, --week, dates, relative words and times without an offset in that zone, whatever the zone of the computer that runs the command (internal/cmd/time_helpers.go). An RFC 3339 value with an offset names an exact instant and needs no zone.
  • Display time zone. --timezone ZONE changes only how event times are printed. Without it, gog displays the event in its own time zone if available and otherwise uses its calendar’s time zone. --timezone local uses the zone of the computer.
gog --account you@example.com calendar events --week --timezone America/Toronto
gog --account you@example.com calendar events --week --timezone local

If “today” looks wrong, check the time zone of the primary calendar in the Google Calendar settings, because that setting decides where the day begins.

More than 1 calendar

gog --account you@example.com calendar events you@example.org --today
gog --account you@example.com calendar events --cal primary --cal "Team" --week --all-pages --sort start
gog --account you@example.com calendar events --all --today --sort start

A positional calendar ID selects 1 calendar. --cal can be repeated, and --calendars takes a comma-separated list of IDs, names or positions. --all reads every calendar on your list.

On gog calendar events, --all selects all calendars and --all-pages fetches all pages of results. On Gmail search commands, --all and --all-pages are aliases.

A page token belongs to 1 calendar, so use --all-pages when you read several calendars. With several calendars, --sort start gives chronological output.

Other listing flags

FlagEffect
--max Nevents per page, 10 by default
--query TEXTfree-text search within the period
--event-types T,...only some event types: default, birthday, focus-time, from-gmail, out-of-office, working-location
--sort start|end|summary|calendar, --order asc|descsort the output; without --sort the API order is kept
--weekday, --locationadd day-of-week or location columns to the table
--fields F,...a field mask: the event fields that the Calendar API itself should return (this command’s own meaning of --fields)
--fail-emptyexit with code 3 when there are no events
gog --account you@example.com calendar events --week --max 50 --weekday --location
gog --account you@example.com calendar events --week --query "review"
gog --account you@example.com calendar events --today --plain

gog calendar search QUERY is a separate command for text search. Its default period runs from 30 days before now to 90 days after now (docs/dates.md), it searches 1 calendar (--calendar, default primary), and it returns up to 25 events:

gog --account you@example.com calendar search "review" --days 14

Fields of the event list

The table has the columns ID, START, END and SUMMARY, with CALENDAR first when several calendars are listed and the optional START_DOW, END_DOW and LOCATION. The JSON is {"events": [...], "nextPageToken": ...} for 1 calendar; for several calendars the page tokens are in nextPageTokens, 1 per calendar (internal/cmd/calendar_list.go).

Each event is the Calendar API event resource, with fields such as id, summary, description, location, start, end, attendees, status and htmlLink. start and end contain either dateTime (with an offset) and timeZone, or date for an all-day event. gog adds fields that make scripts simpler (internal/cmd/calendar_event_days.go):

FieldMeaning
startLocal, endLocalstart and end in RFC 3339 in the display zone, or the date for an all-day event
startDayOfWeek, endDayOfWeekthe weekday names of start and end
timezonethe zone used for the local fields
eventTimezonethe event’s own zone, present only when it differs from timezone
calendarIdthe calendar of the event, in lists that cover several calendars (also repeated as CalendarID)

Reading an event

gog --account you@example.com calendar event primary EVENT_ID
gog --account you@example.com calendar event primary EVENT_ID --json --timezone America/Toronto
gog --account you@example.com calendar raw primary EVENT_ID

gog calendar event CALENDAR_ID EVENT_ID (aliases get, info, show) prints 1 event (internal/cmd/calendar_events_cmds.go). Its JSON is {"event": {...}} with the same fields as a list item. gog calendar raw prints the unprocessed API response.

Creating an event

gog calendar create CALENDAR_ID requires --summary (the title), --from and --to. The calendar ID is a required positional argument, so name primary explicitly (internal/cmd/calendar_edit.go):

$ gog --account you@example.com --dry-run --json calendar create --summary "Review" --from "2026-05-06T10:00:00+02:00" --to "2026-05-06T10:30:00+02:00"
expected "<calendarId>"
{"error":{"class":"usage","code":2,"message":"expected \"\u003ccalendarId\u003e\""}}

A complete timed event with an attendee, a location and a description:

$ gog --account you@example.com --dry-run --json calendar create primary --summary "Project review" --from 2026-12-03T14:00:00-05:00 --to 2026-12-03T15:00:00-05:00 --timezone America/Toronto --attendees friend@example.com --location "Room 4B" --description "Review the open items before the holidays."
{
  "dry_run": true,
  "op": "calendar.create",
  "request": {
    "calendar_id": "primary",
    "conference_version_1": false,
    "event": {
      "attendees": [
        {
          "email": "friend@example.com"
        }
      ],
      "description": "Review the open items before the holidays.",
      "end": {
        "dateTime": "2026-12-03T15:00:00-05:00",
        "timeZone": "America/Toronto"
      },
      "location": "Room 4B",
      "start": {
        "dateTime": "2026-12-03T14:00:00-05:00",
        "timeZone": "America/Toronto"
      },
      "summary": "Project review"
    },
    "send_updates": "",
    "supports_attachments": false
  }
}

The event object is the resource gog will send to the Calendar API. A successful creation prints the new event in the same form as gog calendar event.

Times and time zones when creating

The --from and --to flags for calendar create expect RFC 3339 values. gog copies the text into start.dateTime and end.dateTime unchanged, so relative words such as tomorrow are not converted (see Output, Schemas and Dry Runs). Always include the offset.

The IANA time zone name, such as America/Toronto, is the name of a region’s rules, including daylight saving time; an offset such as -05:00 is only the difference from UTC at 1 moment. --timezone ZONE sets the name on both start and end, and --start-timezone and --end-timezone set them separately; the 2 forms cannot be combined. Without any of them, gog derives a fixed-offset zone from the offset in the time:

$ gog --account you@example.com --dry-run --json calendar create primary --summary "Project review" --from 2026-12-03T14:00:00-05:00 --to 2026-12-03T15:00:00-05:00 | jq '.request.event.start'
{
  "dateTime": "2026-12-03T14:00:00-05:00",
  "timeZone": "Etc/GMT+5"
}

Etc/GMT+5 is a fixed offset of UTC minus 5 hours without any daylight saving rules (the sign in these names is reversed by convention). Pass --timezone America/Toronto so that the event carries the rules of the region in which it takes place. An unknown time zone name causes exit code 2, even in a dry run.

All-day events

--all-day takes dates without a time in --from and --to. gog copies them into start.date and end.date:

$ gog --account you@example.com --dry-run --json calendar create primary --summary "Team offsite" --from 2026-12-10 --to 2026-12-11 --all-day | jq '.request.event'
{
  "end": {
    "date": "2026-12-11"
  },
  "start": {
    "date": "2026-12-10"
  },
  "summary": "Team offsite"
}

An all-day event has no time zone, so gog refuses --timezone with --all-day:

$ gog --account you@example.com --dry-run --json calendar create primary --summary "Team offsite" --from 2026-12-10 --to 2026-12-11 --all-day --timezone America/Toronto
--timezone cannot be used with all-day dates
{"error":{"class":"usage","code":2,"message":"--timezone cannot be used with all-day dates"}}

Attendees, reminders and notifications

--attendees takes a comma-separated list of addresses. A suffix after a semicolon changes 1 attendee: ;optional marks an optional guest, ;resource a room or other resource, and ;comment=TEXT adds a note. --reminder METHOD:DURATION (for example popup:10m or email:1d) replaces the calendar’s default reminders, up to 5 times, and --no-reminders turns reminders off.

$ gog --account you@example.com --dry-run --json calendar create primary --summary "Design sync" --from 2026-12-08T10:00:00-05:00 --to 2026-12-08T10:30:00-05:00 --timezone America/Toronto --attendees "friend@example.com,you@example.org;optional" --reminder popup:10m --send-updates all | jq '.request | {send_updates, attendees: .event.attendees, reminders: .event.reminders}'
{
  "send_updates": "all",
  "attendees": [
    {
      "email": "friend@example.com"
    },
    {
      "email": "you@example.org",
      "optional": true
    }
  ],
  "reminders": {
    "overrides": [
      {
        "method": "popup",
        "minutes": 10
      }
    ],
    "useDefault": false
  }
}

--send-updates decides whether Google emails the guests. Its values are all, externalOnly and none, and the default is none. A create, update or delete without the flag therefore changes the calendar without notifying the guests; pass --send-updates all when they should receive an invitation or a notice. Other values are rejected in the dry run.

Other creation flags include --rrule for recurrence (for example --rrule "RRULE:FREQ=WEEKLY;BYDAY=MO", copied into the event’s recurrence list), --with-meet to add a Google Meet link, --visibility, --transparency busy|free and --event-color. With --with-meet the plan contains a random requestId, so 2 dry runs of the same command differ in that field.

Updating an event

gog calendar update CALENDAR_ID EVENT_ID changes only the fields you name; everything else stays as it is (docs/examples.md). The plan shows this as a patch object. For the time zone, update has --start-timezone and --end-timezone but no --timezone flag:

$ gog --account you@example.com --dry-run --json calendar update primary EVENT_ID --from 2026-12-03T15:00:00-05:00 --to 2026-12-03T16:00:00-05:00 --start-timezone America/Toronto --end-timezone America/Toronto --add-attendee you@example.org
{
  "dry_run": true,
  "op": "calendar.update",
  "request": {
    "add_attendee": "you@example.org",
    "calendar_id": "primary",
    "conference_version_1": false,
    "event_id": "EVENT_ID",
    "original_start_time": "",
    "patch": {
      "end": {
        "dateTime": "2026-12-03T16:00:00-05:00",
        "timeZone": "America/Toronto"
      },
      "start": {
        "dateTime": "2026-12-03T15:00:00-05:00",
        "timeZone": "America/Toronto"
      }
    },
    "scope": "all",
    "send_updates": "",
    "supports_attachments": false,
    "wants_add_attendee": true
  }
}

Use --add-attendee to add guests to the existing list. --attendees replaces the whole list, and --attendees '' removes every guest. Likewise, an empty --summary, --description or --location clears that field:

$ gog --account you@example.com --dry-run --json calendar update primary EVENT_ID --location "" --description ""
{
  "dry_run": true,
  "op": "calendar.update",
  "request": {
    "add_attendee": "",
    "calendar_id": "primary",
    "conference_version_1": false,
    "event_id": "EVENT_ID",
    "original_start_time": "",
    "patch": {
      "description": "",
      "location": ""
    },
    "scope": "all",
    "send_updates": "",
    "supports_attachments": false,
    "wants_add_attendee": false
  }
}

For a recurring event, a series created with --rrule, --scope chooses what to change: all (the default) changes the whole series, single 1 occurrence, and future that occurrence and the ones after it. single and future also need --original-start, the original start time of the occurrence.

Deleting an event

gog calendar delete CALENDAR_ID EVENT_ID takes the same --scope, --original-start and --send-updates flags as update:

$ gog --account you@example.com --dry-run --json calendar delete primary EVENT_ID --send-updates all
{
  "dry_run": true,
  "op": "calendar.delete",
  "request": {
    "calendar_id": "primary",
    "event_id": "EVENT_ID",
    "original_start": "",
    "scope": "all",
    "send_updates": "all"
  }
}

It asks for confirmation. In a non-interactive run it refuses with exit code 2 unless you pass --force (internal/cmd/confirm.go):

$ gog --account you@example.com --no-input calendar delete primary EVENT_ID
refusing to delete event EVENT_ID from calendar primary without --force (non-interactive)

Responding to invitations

gog calendar respond CALENDAR_ID EVENT_ID (aliases rsvp and reply) sets your answer to an invitation. --status takes accepted, declined, tentative or needsAction, and --comment adds a note to your response. Any other status is rejected in the dry run (internal/cmd/calendar_respond.go):

$ gog --account you@example.com --dry-run --json calendar respond primary EVENT_ID --status declined --comment "I am travelling that week."
{
  "dry_run": true,
  "op": "calendar.respond",
  "request": {
    "calendar_id": "primary",
    "comment": "I am travelling that week.",
    "event_id": "EVENT_ID",
    "status": "declined"
  }
}

Proposing a new time is a feature of the Google Calendar web interface only. gog calendar propose-time therefore prints a link that opens the proposal page in a browser.

Checking availability with free/busy data

gog calendar freebusy asks Google which periods are busy on 1 or more calendars and returns only those periods. It takes calendar IDs as a comma-separated argument or with repeated --cal, or --all for every calendar on your list, and the same --from and --to as calendar events:

gog --account you@example.com calendar freebusy you@example.com,you@example.org --from 2026-12-03T09:00:00-05:00 --to 2026-12-03T17:00:00-05:00
gog --account you@example.com calendar freebusy --cal primary --from today --to tomorrow --json

The table has the columns CALENDAR, START and END, 1 row per busy period. The JSON is {"calendars": {...}}, the free/busy map of the Calendar API: 1 key per calendar ID, each with a busy list of periods that have start and end (internal/cmd/calendar_freebusy.go). gog calendar conflicts uses the same data to report overlaps between busy periods across your calendars.

Scripts

The first script prints today’s events from all your calendars in time order, as tab-separated lines. It passes --readonly to block mutating requests.

#!/usr/bin/env bash
# Usage: agenda-today.sh [ACCOUNT]
set -euo pipefail

account=${1:-you@example.com}

events=$(gog --account "$account" --no-input --readonly --json \
  calendar events --all --today --all-pages --sort start --results-only)

printf '%s\n' "$events" |
  jq -r '.[] | [.startLocal, .endLocal, .calendarId, (.summary // "(no title)")] | @tsv'

--results-only picks the events list out of the wrapping object, and startLocal already holds either an RFC 3339 time or, for an all-day event, the date, so the script needs no special case.

The second script checks a proposed slot against your free/busy data and, if the slot is free, prints the event that gog would send to Google. Review the dry-run plan before creating the event.

#!/usr/bin/env bash
# Usage: propose-slot.sh START END TITLE
set -euo pipefail

start=$1
end=$2
title=$3
common=(--account you@example.com --no-input --json)

freebusy=$(gog "${common[@]}" --readonly calendar freebusy you@example.com \
  --from "$start" --to "$end")
busy=$(printf '%s\n' "$freebusy" | jq '[.calendars[]?.busy[]?] | length')

if [ "$busy" -gt 0 ]; then
  echo "the slot overlaps $busy busy period(s); pick another time" >&2
  exit 1
fi

gog "${common[@]}" --dry-run calendar create primary --summary "$title" \
  --from "$start" --to "$end" --timezone America/Toronto |
  jq '.request.event'
./propose-slot.sh 2026-12-03T14:00:00-05:00 2026-12-03T15:00:00-05:00 "Project review"

The script passes the RFC 3339 values unchanged to both commands. That matters: freebusy would also accept tomorrow, but create would forward the word as it is.