| name | gog-cli |
| description | Google Workspace CLI for Gmail, Calendar, Drive, Docs, Sheets, Tasks, and more |
gog-cli Skill
Fast, script-friendly CLI for Google Workspace services: Gmail, Calendar, Drive, Docs, Sheets, Slides, Chat, Classroom, Contacts, Tasks, People, Groups, and Keep.
Prerequisites
brew install steipete/tap/gogcli
gog auth credentials <path/to/client_secret.json>
gog auth add user@gmail.com --services all
Core Principles
- Always use
--json for parsing command output - human-readable output is for display only
- Verify before destructive operations - list/search before delete/modify
- Use
--force only when explicitly requested by user
- Check account context with
gog auth status when working across multiple accounts
Quick Reference
| Service | List | Get | Create | Search |
|---|
| Gmail | gog gmail search "..." | gog gmail thread get <id> | gog gmail send ... | Same as list |
| Calendar | gog calendar events <cal> | gog calendar event <cal> <id> | gog calendar create <cal> | --query flag |
| Drive | gog drive ls | gog drive get <id> | gog drive upload <file> | gog drive search "..." |
| Tasks | gog tasks list <listId> | gog tasks get <list> <id> | gog tasks add <list> | N/A |
| Contacts | gog contacts list | gog contacts get <id> | gog contacts create | gog contacts search "..." |
Common Workflows
Email Management
gog gmail search "is:unread" --json
gog gmail thread get <threadId> --json
gog gmail send --to user@example.com --subject "Subject" --body "Message" --attach file.pdf
gog gmail send --to user@example.com --subject "Re: Subject" --body "Reply" --reply-to-message-id <msgId>
gog gmail thread modify <threadId> --add "Label Name"
Calendar Operations
gog calendar events primary --from "$(date +%Y-%m-%d)T00:00:00" --to "$(date +%Y-%m-%d)T23:59:59" --json
gog calendar create primary --summary "Meeting" --from "2024-12-20T14:00:00" --to "2024-12-20T15:00:00" --attendees "user@example.com"
gog calendar freebusy "user1@example.com,user2@example.com" --from <start> --to <end> --json
gog calendar respond primary <eventId> --status accepted
File Operations
gog drive search "quarterly report" --json
gog drive download <fileId> --out ~/Downloads/
gog drive upload file.pdf --parent <folderId>
gog drive share <fileId> --email user@example.com --role writer
Spreadsheet Operations
gog sheets read <spreadsheetId> "Sheet1!A1:D10" --json
gog sheets write <spreadsheetId> "Sheet1!A1" --values '[["Name","Value"],["Alice",100]]'
gog sheets append <spreadsheetId> "Sheet1!A:B" --values '[["New","Row"]]'
Output Modes
| Flag | Format | Use Case |
|---|
| (none) | Human-readable | Display to user |
--json | JSON | Parsing, scripting |
--plain | TSV | Shell piping |
Multi-Account Usage
gog --account work@example.com gmail search "is:unread"
export GOG_ACCOUNT=work@example.com
gog auth alias set work work@example.com
gog --account work gmail search "is:unread"
Error Recovery
| Error | Solution |
|---|
| Token expired | gog auth add user@gmail.com --force-consent |
| Wrong scopes | Re-add with required services: --services gmail,calendar,drive |
| Rate limited | Wait and retry; use --max to limit batch sizes |
Safety Guidelines
Destructive operations requiring confirmation:
gog drive delete - moves to trash
gog calendar delete - removes event
gog gmail filters delete - removes filter rule
Prefer these safe patterns:
- Search/list before modifying:
gog gmail search "..." --json then modify
- Use labels over delete:
gog gmail thread modify <id> --add Archive --remove INBOX
- Download before deleting:
gog drive download <id> then gog drive delete <id>
References
- Command Reference - Complete command syntax
- Gmail Operations - Search syntax, sending, labels
- Calendar Operations - Events, availability, recurrence
- Drive & Docs - Files, Sheets, export
- Authentication - Multi-account, service accounts
- Configuration - Environment variables, output formats
- Other Services - Tasks, Contacts, Chat, Classroom