GOG Extended
/install gog-extended
gog-extended
Complete reference for the gog CLI with focus on advanced Gmail operations (full email bodies, attachments, complex searches).
Setup (one-time)
gog auth credentials /path/to/client_secret.json
gog auth add [email protected] --services gmail,calendar,drive,contacts,docs,sheets
gog auth list
Gmail Operations
Search & Browse
-
Search threads (one row per thread):
gog gmail search 'newer_than:7d' --max 10 gog gmail search 'from:[email protected]' --max 20 -
Search individual messages (ignores threading, returns all matches):
gog gmail messages search "in:inbox from:ryanair.com" --max 20 --account [email protected] gog gmail messages search 'subject:invoice' --max 50
Read Full Email Content (Critical for Automation)
This is the key difference from basic search — retrieve the complete email body, headers, and content:
# Full email with HTML body (recommended for parsing and automation)
gog gmail get \x3CmessageId> --format=full --account [email protected]
# Metadata only (faster, no body)
gog gmail get \x3CmessageId> --format=metadata --account [email protected]
# Raw RFC 2822 format (MIME encoded)
gog gmail get \x3CmessageId> --format=raw --account [email protected]
Recommendation: Use --format=full (default) which returns HTML-formatted email bodies. HTML preserves structure, links, and formatting better than raw RFC 2822, making it easier to parse and extract data programmatically.
Example workflow (extracting order details from email):
# 1. Find the message
gog gmail messages search 'from:[email protected] subject:confirmation' --max 1 --account [email protected]
# 2. Extract the message ID from results
# 3. Read full content (returns HTML body for easy parsing)
gog gmail get \x3CmessageId> --format=full --account [email protected]
# 4. Parse HTML for data (grep, sed, or HTML parser)
gog gmail get \x3CmessageId> --format=full --account [email protected] | grep -i "order\|price\|quantity"
The HTML format makes it easier to identify structure (tables, divs, links) and extract data without dealing with raw MIME encoding.
Download Attachments
gog gmail attachment \x3CmessageId> \x3CattachmentId>
Get attachment IDs from gog gmail get \x3CmessageId> --format=full output.
Send Emails
-
Plain text:
gog gmail send --to [email protected] --subject "Hi" --body "Hello" -
Multi-line (via file):
gog gmail send --to [email protected] --subject "Hi" --body-file ./message.txt -
Multi-line (via stdin):
gog gmail send --to [email protected] --subject "Hi" --body-file - \x3C\x3C'EOF' Hi there, This is a test. Cheers EOF -
HTML:
gog gmail send --to [email protected] --subject "Hi" --body-html "\x3Cp>Hello\x3C/p>"
Drafts
gog gmail drafts create --to [email protected] --subject "Hi" --body-file ./message.txt
gog gmail drafts send \x3CdraftId>
Reply to Messages
gog gmail send --to [email protected] --subject "Re: Hi" --body "Reply" --reply-to-message-id \x3CmsgId>
Gmail History (Last Changes)
gog gmail history --max 100
Gmail URL Links
gog gmail url \x3CthreadId> ...
Prints direct Gmail web URLs.
Calendar Operations
List Events
gog calendar events \x3CcalendarId> --from 2026-01-01T00:00:00Z --to 2026-12-31T23:59:59Z
Create Event
gog calendar create \x3CcalendarId> --summary "Meeting" --from 2026-03-30T10:00:00Z --to 2026-03-30T11:00:00Z
With color (IDs 1–11):
gog calendar create \x3CcalendarId> --summary "Important" --from 2026-03-30T10:00:00Z --to 2026-03-30T11:00:00Z --event-color 4
Update Event
gog calendar update \x3CcalendarId> \x3CeventId> --summary "New Title" --event-color 7
View Color Palette
gog calendar colors
Color IDs:
- 1: #a4bdfc (blue)
- 2: #7ae7bf (teal)
- 3: #dbadff (purple)
- 4: #ff887c (red)
- 5: #fbd75b (yellow)
- 6: #ffb878 (orange)
- 7: #46d6db (cyan)
- 8: #e1e1e1 (gray)
- 9: #5484ed (dark blue)
- 10: #51b749 (green)
- 11: #dc2127 (dark red)
Drive Operations
gog drive search "filename:report.pdf" --max 10
gog drive search "in:starred" --max 20
Contacts
gog contacts list --max 20
gog contacts list --max 50 --json
Sheets
Read Data
gog sheets get \x3CsheetId> "Tab!A1:D10" --json
gog sheets metadata \x3CsheetId> --json
Update Data
gog sheets update \x3CsheetId> "Tab!A1:B2" --values-json '[["A","B"],["1","2"]]' --input USER_ENTERED
Append Data
gog sheets append \x3CsheetId> "Tab!A:C" --values-json '[["x","y","z"]]' --insert INSERT_ROWS
Clear Data
gog sheets clear \x3CsheetId> "Tab!A2:Z"
Docs
Export
gog docs export \x3CdocId> --format txt --out /tmp/doc.txt
gog docs export \x3CdocId> --format pdf --out /tmp/doc.pdf
Read (cat)
gog docs cat \x3CdocId>
Advanced Flags
Common Flags
--account [email protected]— Target specific account (required when multiple accounts configured)--json— Output JSON (best for scripting)--plain— Stable TSV format (no colors)--dry-run— Preview changes without executing--force— Skip confirmations--no-input— Never prompt (useful for CI/automation)--verbose— Enable verbose logging
Environment Variable
Avoid repeating --account by setting:
export [email protected]
Then:
gog gmail search 'newer_than:7d' # Uses GOG_ACCOUNT automatically
Gmail Query Syntax
Powerful search operators for gog gmail search and gog gmail messages search:
newer_than:7d— Last 7 daysbefore:2026-03-30— Before dateafter:2026-03-20— After datefrom:[email protected]— From specific senderto:[email protected]— To specific recipientsubject:keywords— Subject containsin:inbox— In inbox (also:sent,draft,starred,important)is:unread— Unread messageshas:attachment— Has attachmentfilename:document.pdf— Attachment namelabel:custom_label— Custom labels
Complex queries:
gog gmail search 'from:[email protected] subject:invoice after:2026-03-01'
gog gmail search 'in:inbox is:unread has:attachment'
Notes
- Search vs Messages:
gog gmail searchreturns one row per thread; usegog gmail messages searchwhen you need every individual email. - Multi-account: When multiple accounts are configured, always specify
--account [email protected]. - Token efficiency: For scripting, use
--jsonoutput and parse programmatically. - Email body extraction: Use
gog gmail get \x3CmessageId> --format=fullto retrieve complete email content (critical for automation like order tracking, invoice extraction, etc.). - Docs are read-only in gog: In-place edits require a separate Docs API client; gog supports export and read-only operations.
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install gog-extended - After installation, invoke the skill by name or use
/gog-extended - Provide required inputs per the skill's parameter spec and get structured output
What is GOG Extended?
Extended Google Workspace CLI reference for Gmail, Calendar, Drive, Contacts, Sheets, and Docs. Includes complete email body retrieval, attachments, and adva... It is an AI Agent Skill for Claude Code / OpenClaw, with 165 downloads so far.
How do I install GOG Extended?
Run "/install gog-extended" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is GOG Extended free?
Yes, GOG Extended is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does GOG Extended support?
GOG Extended is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created GOG Extended?
It is built and maintained by Ethan Yanjia Li (@ethanyanjiali); the current version is v2.1.0.