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.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install gog-extended - 安装完成后,直接呼叫该 Skill 的名称或使用
/gog-extended触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
GOG Extended 是什么?
Extended Google Workspace CLI reference for Gmail, Calendar, Drive, Contacts, Sheets, and Docs. Includes complete email body retrieval, attachments, and adva... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 165 次。
如何安装 GOG Extended?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install gog-extended」即可一键安装,无需额外配置。
GOG Extended 是免费的吗?
是的,GOG Extended 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
GOG Extended 支持哪些平台?
GOG Extended 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 GOG Extended?
由 Ethan Yanjia Li(@ethanyanjiali)开发并维护,当前版本 v2.1.0。