Google Workspace (gog)

Google Workspace CLI for Gmail, Calendar, Drive, Contacts, Sheets, and Docs. Full OAuth-based access to Google services.

gog (Google Workspace CLI) is a comprehensive Go-based CLI by Peter Steinberger (steipete) that unifies Gmail, Calendar, Chat, Classroom, Drive, Docs, Slides, Sheets, Forms, Apps Script, Contacts, Tasks, People, Admin, Groups, and Keep under one binary. It's the Swiss Army knife for Google Workspace — JSON-first output, multiple account support, and sane defaults. The breadth is staggering: Gmail (search threads, send mail, manage labels/drafts/filters, watch via Pub/Sub), Calendar (events, invitations, conflicts, free/busy, focus/OOO), Drive (list/search/upload/download, permissions, shared drives), Sheets (read/write, format cells, manage tabs), Docs/Slides (create, export, import Markdown), Contacts (personal + directory), Tasks (full CRUD with RRULE scheduling), and even email tracking with a Cloudflare Worker backend. Authentication is flexible and well-designed: OAuth refresh tokens, Application Default Credentials (ADC), direct access tokens, service accounts, and manual/remote flows for headless environments. You can manage multiple Google accounts simultaneously with aliases and per-client OAuth buckets. Least-privilege auth options (`--readonly`, `--drive-scope`, `--gmail-scope`) let you request only the permissions you need. For OpenClaw users, gog is the gateway to Google Workspace. Your AI assistant can check email, review your calendar, upload files to Drive, create spreadsheets, and manage contacts — all through clean CLI commands with JSON output. Combined with cron, it enables powerful automation: morning email summaries, calendar conflict detection, automated report generation. CAUTION: Google's automated systems may flag brand-new accounts with immediate API activity as bot-created. Use an established account and be aware of Google's rate limits and terms of service. Best suited for: anyone using Google Workspace who wants terminal/AI access, developers automating Gmail and Calendar workflows, teams building Google Workspace integrations, OpenClaw users wanting their AI to manage email and calendar.

Tags: google, gmail, calendar, drive, sheets, productivity

Category: Productivity

Use Cases

  • Morning email briefing: check unread emails via OpenClaw heartbeat
  • Calendar conflict detection before scheduling meetings
  • Automated report generation: create Sheets/Docs from data
  • Send emails with AI-generated content
  • Upload files to Drive as part of automation workflows
  • Manage contacts: add people you meet to Google Contacts from chat
  • Task management: create and complete Google Tasks from the terminal
  • Export data: download Docs as Markdown, Sheets as CSV

Tips

  • Set `GOG_ACCOUNT=you@gmail.com` as an env var to avoid typing `--account` every time
  • Use `gog auth manage` to set a default account for all commands
  • Use `--readonly` for read-only access when you don't need write permissions
  • Combine with OpenClaw cron for automated email summaries and calendar checks
  • Use `--json` output with jq for all automation workflows
  • Re-auth with `--force-consent` if you add new scopes and Google doesn't return a refresh token
  • For headless servers, use `gog auth add --manual` for a copy-paste auth flow
  • Use an established Google account — don't create new accounts just for API access

Known Issues & Gotchas

  • Requires Google Cloud OAuth2 credentials setup — follow the quickstart carefully
  • Brand-new Google accounts with immediate API activity may get suspended by Google's bot detection
  • OAuth consent screen starts in 'testing' mode — limited to 100 users until published
  • Keep commands require Workspace admin + domain-wide delegation (not available for personal accounts)
  • Some features (Chat, Admin, Groups) are Workspace-only — won't work with personal Gmail
  • Token refresh happens automatically but initial auth requires a browser flow
  • Rate limits vary by Google API — Gmail is 250 quota units/user/second
  • Email tracking feature requires deploying a Cloudflare Worker backend

Alternatives

  • Google Workspace CLI (official)
  • himalaya (email)
  • gcalcli
  • rclone (Drive)
  • Google Apps Script

Community Feedback

OpenClaw + GogCLI = Google Account Suspension. A brand-new account followed almost immediately by API activation and automated interactions could easily look suspicious from Google's perspective. Use an established account.

— Reddit r/openclaw

The gogcli tool developed by the OpenClaw team is incredible — Gmail, Calendar, Drive, Contacts, Tasks under one CLI with JSON output. Perfect for agent automation.

— Twitter/X

Google is working to give OpenClaw easier access to Google Workspace. The gogcli tool has become the de facto CLI interface for Gmail, Calendar, and Drive automation.

— Android Authority

Released gog: A CLI for Gmail, Calendar, Drive, Contacts, and more. JSON-first, multi-account, flexible auth. Google in your terminal.

— Twitter/X (Peter Friese)

Configuration Examples

Initial setup

# Install
brew install gogcli

# Store OAuth credentials
gog auth credentials ~/Downloads/client_secret_....json

# Authorize your account
gog auth add you@gmail.com

# Set default account
export GOG_ACCOUNT=you@gmail.com

Gmail operations

# Search recent emails
gog gmail search 'newer_than:1d is:unread' --max 10 --json | jq

# Send an email
gog gmail send --to 'colleague@example.com' --subject 'Meeting notes' --body 'Here are the notes from today...'

# List labels
gog gmail labels list

Calendar management

# Today's events
gog calendar events --max 10 --json | jq '.events[] | {summary, start, end}'

# Check free/busy
gog calendar free-busy --start tomorrow --end 'tomorrow 18:00'

# Create an event
gog calendar events create --summary 'Team standup' --start '2026-03-22T09:00:00' --end '2026-03-22T09:30:00'

Drive and Docs

# List recent files
gog drive ls --max 10 --json | jq '.files[] | {name, mimeType}'

# Upload a file
gog drive upload ./report.pdf --folder 'Reports'

# Export a Doc as Markdown
gog docs export <doc-id> --format markdown -o report.md

Installation

brew install steipete/tap/gogcli

Homepage: https://gogcli.sh

Source: bundled