| name | gw |
| description | Access Google Workspace via gw CLI (Gmail, Calendar, Drive, Sheets, Docs, Contacts, Tasks, Meet). Permanent OAuth (never expires). Use when: (1) Checking calendar (today/week/agenda), (2) Sending/searching/reading Gmail, (3) Managing Drive files, (4) Reading/writing Sheets, (5) Reading/exporting Docs, (6) Searching contacts.
|
gw — Google Workspace CLI
Binary: /opt/homebrew/bin/gw (or which gw)
Config: ~/.config/gw/config.toml
Auth: Permanent OAuth 2.0 (auto-refresh, never expires)
Global Flags
| Flag | Description |
|---|
--json | Output as JSON (works on all commands) |
--profile TEXT | Use a named profile from config.toml (multi-account) |
--version | Show version |
Auth Commands
gw auth login
gw auth logout
gw auth status
gw auth setup
Gmail Commands
List / Read
gw gmail list
gw gmail list --max 20
gw gmail read <message_id>
gw gmail thread <thread_id>
gw gmail search "query"
gw gmail count
Send / Reply / Forward
gw gmail send TO SUBJECT BODY
gw gmail send "to@example.com" "Subject" "Body text"
gw gmail send "to@example.com" "Subject" "Body" --cc "cc@example.com"
gw gmail send "to@example.com" "Subject" "Body" --bcc "bcc@example.com"
gw gmail draft "to@example.com" "Subject" "Body text"
gw gmail reply <message_id> "Reply body"
gw gmail forward <message_id> "to@example.com"
Manage
gw gmail mark-read <message_id>
gw gmail mark-unread <message_id>
gw gmail archive <message_id>
gw gmail trash <message_id>
gw gmail label <message_id> LABEL
gw gmail star <message_id>
JSON output
gw --json gmail list
gw --json gmail search "from:boss@example.com newer_than:7d"
Calendar Commands
View Events
gw calendar today
gw calendar today --all
gw calendar tomorrow --all
gw calendar week --all
gw calendar agenda --all
gw calendar next --all
gw calendar list --all
Create / Update / Delete
gw calendar create "Meeting" "2026-03-27T14:00:00" "2026-03-27T15:00:00"
gw calendar create "Meeting" "2026-03-27T14:00:00" "2026-03-27T15:00:00" \
--description "Discuss roadmap" \
--reminder 15 \
--calendar "calendar_id"
gw calendar create "Birthday" "2026-03-27" "2026-03-28" --all-day
gw calendar create "Weekly Sync" "2026-03-27T10:00:00" "2026-03-27T11:00:00" \
--recurrence "RRULE:FREQ=WEEKLY;BYDAY=FR"
gw calendar update <event_id>
gw calendar delete <event_id>
gw meet create
gw meet create --title "Team Sync"
JSON output
gw --json calendar today --all
gw --json calendar week --all
Drive Commands
gw drive list
gw drive list --max 20
gw drive search "query"
gw drive upload /path/to/file
gw drive upload /path/to/file --name "Custom Name"
gw drive upload /path/to/file --folder "folder_id"
gw drive download <file_id>
gw drive mkdir "Projects"
gw drive share <file_id> user@example.com --role writer
gw drive info <file_id>
JSON output
gw --json drive list
gw --json drive search "report 2026"
Sheets Commands
gw sheets read <spreadsheet_id> <range>
gw sheets read "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms" "Sheet1!A1:D20"
gw sheets write <spreadsheet_id> <range> <values>
gw sheets write "spreadsheet_id" "Sheet1!A1" '[["Hello", "World"]]'
JSON output
gw --json sheets read "spreadsheet_id" "Sheet1!A1:C10"
Docs Commands
gw docs list
gw docs read <document_id>
gw docs export <document_id>
JSON output
gw --json docs list
gw --json docs read <document_id>
Contacts Commands
gw contacts list
gw contacts search "query"
JSON output
gw --json contacts search "Victor"
Tasks Commands
gw tasks lists
gw tasks list
gw tasks list --list <list_id>
gw tasks add "Buy milk"
gw tasks add "Buy milk" --notes "2L" --due 2026-04-01
gw tasks complete <task_id>
gw tasks delete <task_id>
JSON output
gw --json tasks list
gw --json tasks add "Prepare review" --due 2026-04-02
Diagnostics & Config
gw doctor
gw config show
gw --version
Multi-Account (Profiles)
Define profiles in ~/.config/gw/config.toml:
[profiles.work]
credentials_file = "~/.config/gw/work-credentials.json"
[profiles.personal]
credentials_file = "~/.config/gw/personal-credentials.json"
Use:
gw --profile work calendar today --all
gw --profile personal gmail list
Agent Rules
- Calendar: Always use
--all unless user explicitly asks for primary only
- Gmail send: Show draft (to/subject/body), get confirmation, then execute
- JSON: Use
--json when output needs to be parsed/processed programmatically
- Auth: Token never expires — no troubleshooting needed
- Timezone: Uses
America/Sao_Paulo automatically