Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGoogle Workspace Skill
Google Workspace 技能
This skill provides Google Workspace integration using the CLI (gogcli). The agent calls directly for all operations.
goggogPrerequisites
前置条件
Install the binary:
gogbash
undefined安装二进制文件:
gogbash
undefinedHomebrew
Homebrew
brew install openclaw/tap/gogcli
brew install openclaw/tap/gogcli
Manual (Linux amd64)
手动安装(Linux amd64)
curl -sL https://github.com/openclaw/gogcli/releases/latest/download/gogcli_VERSION_linux_amd64.tar.gz | tar xz
mv gog ~/.local/bin/
See [configuration.md](references/configuration.md) for container and MCP server alternatives.curl -sL https://github.com/openclaw/gogcli/releases/latest/download/gogcli_VERSION_linux_amd64.tar.gz | tar xz
mv gog ~/.local/bin/
如需容器和MCP服务器替代方案,请查看[configuration.md](references/configuration.md)。Authentication
身份验证
bash
undefinedbash
undefinedImport credentials.json from Google Cloud Console
导入Google Cloud Console中的credentials.json文件
gog auth credentials set /path/to/credentials.json
gog auth credentials set /path/to/credentials.json
Authorize with only the services you need (opens browser)
仅授权所需服务(将打开浏览器)
gog auth add your@email.com --services gmail,calendar,drive,docs,sheets,slides
gog auth add your@email.com --services gmail,calendar,drive,docs,sheets,slides
Verify
验证授权
gog auth doctor
undefinedgog auth doctor
undefinedMigrating from legacy Python OAuth
从旧版Python OAuth迁移
If you previously used the Python-based Google skills, clean up the old tokens and config:
bash
$SKILL_DIR/scripts/google.py cleanupThen set up fresh authentication with gog as described above.
如果您之前使用基于Python的Google技能,请清理旧令牌和配置:
bash
$SKILL_DIR/scripts/google.py cleanup然后按照上述步骤使用gog重新设置身份验证。
Quick Reference
快速参考
bash
gog gmail search "is:unread" # Search email
gog calendar events --today # Today's events
gog drive search "quarterly report" # Search files
gog docs cat <docId> # Read a document
gog sheets get <spreadsheetId> "Sheet1!A1:D10" # Read spreadsheet range
gog slides info <presentationId> # Presentation metadataAll commands support for structured output and for TSV.
--json--plainbash
gog gmail search "is:unread" # 搜索邮件
gog calendar events --today # 今日日程
gog drive search "quarterly report" # 搜索文件
gog docs cat <docId> # 读取文档
gog sheets get <spreadsheetId> "Sheet1!A1:D10" # 读取电子表格指定区域
gog slides info <presentationId> # 获取演示文稿元数据所有命令均支持参数以输出结构化数据,支持参数以输出TSV格式数据。
--json--plainCommands
命令列表
Check Setup
检查设置
bash
$SKILL_DIR/scripts/google.py checkbash
$SKILL_DIR/scripts/google.py checkGmail
Gmail
bash
undefinedbash
undefinedSearch
搜索
gog gmail search "from:boss@example.com newer_than:7d"
gog gmail search "is:unread label:inbox" --max 20
gog gmail search "from:boss@example.com newer_than:7d"
gog gmail search "is:unread label:inbox" --max 20
Read
读取
gog gmail get <messageId>
gog gmail thread get <threadId>
gog gmail labels list
gog gmail get <messageId>
gog gmail thread get <threadId>
gog gmail labels list
Organize
整理邮件
gog gmail mark-read <messageId>
gog gmail unread <messageId>
gog gmail archive <messageId>
gog gmail trash <messageId>
gog gmail mark-read <messageId>
gog gmail unread <messageId>
gog gmail archive <messageId>
gog gmail trash <messageId>
Send
发送邮件
gog gmail send --to "user@example.com" --subject "Hello" --body "Message body"
gog gmail reply <messageId> --body "Reply text"
gog gmail forward <messageId> --to "other@example.com"
gog gmail send --to "user@example.com" --subject "Hello" --body "Message body"
gog gmail reply <messageId> --body "Reply text"
gog gmail forward <messageId> --to "other@example.com"
Drafts
草稿管理
gog gmail drafts list
gog gmail drafts create --to "user@example.com" --subject "Draft" --body "Content"
gog gmail drafts send <draftId>
See [gmail.md](references/gmail.md) for the full command reference.gog gmail drafts list
gog gmail drafts create --to "user@example.com" --subject "Draft" --body "Content"
gog gmail drafts send <draftId>
完整命令参考请查看[gmail.md](references/gmail.md)。Google Calendar
Google 日历
bash
undefinedbash
undefinedView
查看
gog calendar calendars
gog calendar events --today
gog calendar events --from "2026-06-25" --to "2026-06-30"
gog calendar event <calendarId> <eventId>
gog calendar freebusy --from "2026-06-25T09:00:00Z" --to "2026-06-25T17:00:00Z"
gog calendar search "standup"
gog calendar calendars
gog calendar events --today
gog calendar events --from "2026-06-25" --to "2026-06-30"
gog calendar event <calendarId> <eventId>
gog calendar freebusy --from "2026-06-25T09:00:00Z" --to "2026-06-25T17:00:00Z"
gog calendar search "standup"
Create
创建日程
gog calendar create primary --summary "Meeting" --from "2026-06-25T10:00:00" --to "2026-06-25T11:00:00"
gog calendar create primary --summary "Meeting" --from "2026-06-25T10:00:00" --to "2026-06-25T11:00:00"
Manage
管理日程
gog calendar update <calendarId> <eventId> --summary "Updated title"
gog calendar delete <calendarId> <eventId>
gog calendar respond <calendarId> <eventId> --status accepted
See [calendar.md](references/calendar.md) for the full command reference.gog calendar update <calendarId> <eventId> --summary "Updated title"
gog calendar delete <calendarId> <eventId>
gog calendar respond <calendarId> <eventId> --status accepted
完整命令参考请查看[calendar.md](references/calendar.md)。Google Drive
Google 云端硬盘
bash
undefinedbash
undefinedBrowse
浏览
gog drive ls
gog drive ls --folder <folderId>
gog drive search "quarterly report"
gog drive tree
gog drive get <fileId>
gog drive ls
gog drive ls --folder <folderId>
gog drive search "quarterly report"
gog drive tree
gog drive get <fileId>
File operations
文件操作
gog drive upload report.pdf --parent <folderId>
gog drive download <fileId>
gog drive copy <fileId> "Copy of Report"
gog drive move <fileId> --parent <newFolderId>
gog drive rename <fileId> "New Name"
gog drive delete <fileId>
gog drive upload report.pdf --parent <folderId>
gog drive download <fileId>
gog drive copy <fileId> "Copy of Report"
gog drive move <fileId> --parent <newFolderId>
gog drive rename <fileId> "New Name"
gog drive delete <fileId>
Sharing
共享设置
gog drive share <fileId> --email "user@example.com" --role writer
gog drive permissions <fileId>
gog drive unshare <fileId> <permissionId>
See [drive.md](references/drive.md) for the full command reference.gog drive share <fileId> --email "user@example.com" --role writer
gog drive permissions <fileId>
gog drive unshare <fileId> <permissionId>
完整命令参考请查看[drive.md](references/drive.md)。Google Docs
Google 文档
bash
undefinedbash
undefinedRead
读取
gog docs info <docId>
gog docs cat <docId>
gog docs export <docId> --format md
gog docs structure <docId>
gog docs info <docId>
gog docs cat <docId>
gog docs export <docId> --format md
gog docs structure <docId>
Write
编辑
gog docs create "New Document"
gog docs write <docId> --body "Content to append"
gog docs insert <docId> "Text to insert" --at 1
gog docs find-replace <docId> "old text" "new text"
gog docs format <docId> --bold --start 1 --end 10
gog docs create "New Document"
gog docs write <docId> --body "Content to append"
gog docs insert <docId> "Text to insert" --at 1
gog docs find-replace <docId> "old text" "new text"
gog docs format <docId> --bold --start 1 --end 10
Tables
表格操作
gog docs insert-table <docId> --rows 3 --cols 4
gog docs cell-update <docId> --row 1 --col 1 --body "Header"
See [docs.md](references/docs.md) for the full command reference.gog docs insert-table <docId> --rows 3 --cols 4
gog docs cell-update <docId> --row 1 --col 1 --body "Header"
完整命令参考请查看[docs.md](references/docs.md)。Google Sheets
Google 表格
bash
undefinedbash
undefinedRead
读取
gog sheets metadata <spreadsheetId>
gog sheets get <spreadsheetId> "Sheet1!A1:D10"
gog sheets get <spreadsheetId> "Sheet1!A:A" --format FORMULA
gog sheets metadata <spreadsheetId>
gog sheets get <spreadsheetId> "Sheet1!A1:D10"
gog sheets get <spreadsheetId> "Sheet1!A:A" --format FORMULA
Write
编辑
gog sheets create "New Spreadsheet"
gog sheets update <spreadsheetId> "Sheet1!A1" "value1" "value2" "value3"
gog sheets append <spreadsheetId> "Sheet1!A:D" "val1" "val2" "val3" "val4"
gog sheets clear <spreadsheetId> "Sheet1!A1:D10"
gog sheets create "New Spreadsheet"
gog sheets update <spreadsheetId> "Sheet1!A1" "value1" "value2" "value3"
gog sheets append <spreadsheetId> "Sheet1!A:D" "val1" "val2" "val3" "val4"
gog sheets clear <spreadsheetId> "Sheet1!A1:D10"
Structure
结构管理
gog sheets add-tab <spreadsheetId> "New Tab"
gog sheets delete-tab <spreadsheetId> "Old Tab"
gog sheets rename-tab <spreadsheetId> "Old Name" "New Name"
See [sheets.md](references/sheets.md) for the full command reference.gog sheets add-tab <spreadsheetId> "New Tab"
gog sheets delete-tab <spreadsheetId> "Old Tab"
gog sheets rename-tab <spreadsheetId> "Old Name" "New Name"
完整命令参考请查看[sheets.md](references/sheets.md)。Google Slides
Google 幻灯片
bash
undefinedbash
undefinedRead
读取
gog slides info <presentationId>
gog slides list-slides <presentationId>
gog slides read-slide <presentationId> <slideId>
gog slides export <presentationId> --format pptx
gog slides info <presentationId>
gog slides list-slides <presentationId>
gog slides read-slide <presentationId> <slideId>
gog slides export <presentationId> --format pptx
Create
创建
gog slides create "New Presentation"
gog slides create-from-markdown "Deck Title" --file slides.md
gog slides create-from-template <templateId> "From Template" --replacements '{"{{NAME}}":"Value"}'
gog slides create "New Presentation"
gog slides create-from-markdown "Deck Title" --file slides.md
gog slides create-from-template <templateId> "From Template" --replacements '{"{{NAME}}":"Value"}'
Edit
编辑
gog slides new-slide <presentationId>
gog slides insert-text <presentationId> <objectId> "Text content"
gog slides replace-text <presentationId> "find" "replace"
gog slides insert-image <presentationId> <slideId> image.png --width 300
See [slides.md](references/slides.md) for the full command reference.gog slides new-slide <presentationId>
gog slides insert-text <presentationId> <objectId> "Text content"
gog slides replace-text <presentationId> "find" "replace"
gog slides insert-image <presentationId> <slideId> image.png --width 300
完整命令参考请查看[slides.md](references/slides.md)。Examples
示例
Search and summarize recent emails
搜索并汇总近期未读邮件
bash
gog gmail search "is:unread newer_than:7d" --json --results-only | jq '.[] | "\(.from): \(.subject)"'bash
gog gmail search "is:unread newer_than:7d" --json --results-only | jq '.[] | "\(.from): \(.subject)"'Create a calendar event for tomorrow
创建明天的日历日程
bash
TOMORROW=$(date -d '+1 day' '+%Y-%m-%dT09:00:00')
gog calendar create primary --summary "Team Standup" --from "$TOMORROW" --to "${TOMORROW%T*}T09:30:00"bash
TOMORROW=$(date -d '+1 day' '+%Y-%m-%dT09:00:00')
gog calendar create primary --summary "Team Standup" --from "$TOMORROW" --to "${TOMORROW%T*}T09:30:00"Download recent documents
下载近期文档
bash
gog drive search "type:document newer_than:7d" --json --results-only | jq -r '.[] | .id' | \
while read docId; do gog docs export "$docId" --format md > "doc_$docId.md"; donebash
gog drive search "type:document newer_than:7d" --json --results-only | jq -r '.[] | .id' | \
while read docId; do gog docs export "$docId" --format md > "doc_$docId.md"; doneCheck availability for a meeting
检查会议可用时段
bash
gog calendar freebusy --from "2026-06-25T09:00:00Z" --to "2026-06-25T17:00:00Z"bash
gog calendar freebusy --from "2026-06-25T09:00:00Z" --to "2026-06-25T17:00:00Z"Output Formatting
输出格式
bash
undefinedbash
undefinedJSON output (structured, for scripting)
JSON输出(结构化,适用于脚本)
gog gmail search "is:unread" --json --results-only
gog gmail search "is:unread" --json --results-only
Plain/TSV output (stable, parseable)
纯文本/TSV输出(格式稳定,易解析)
gog drive ls --plain
gog drive ls --plain
Select specific fields
选择指定字段输出
gog gmail search "is:unread" --json --select "id,subject,from"
undefinedgog gmail search "is:unread" --json --select "id,subject,from"
undefinedAgent Safety
Agent安全设置
bash
undefinedbash
undefinedRead-only mode (blocks all mutations)
只读模式(阻止所有修改操作)
gog --readonly gmail search "test"
gog --readonly gmail search "test"
Block Gmail send specifically
禁止Gmail发送功能
gog --gmail-no-send gmail search "test"
gog --gmail-no-send gmail search "test"
Preview actions without executing
预览操作不实际执行
gog --dry-run drive delete <fileId>
gog --dry-run drive delete <fileId>
Disable interactive prompts (fail instead)
禁用交互式提示(直接失败)
gog --no-input calendar create primary --summary "Test"
undefinedgog --no-input calendar create primary --summary "Test"
undefinedError Handling
错误处理
| Exit Code | Meaning | Retryable |
|---|---|---|
| 0 | Success | - |
| 3 | Empty results | No (normal) |
| 4 | Auth required | No (run |
| 5 | Not found | No |
| 6 | Permission denied | No |
| 7 | Rate limited | Yes (wait and retry) |
| 8 | Retryable server error | Yes (wait and retry) |
Authentication and permission errors require user intervention. Rate limiting and server errors can be retried after a brief wait.
| 退出码 | 含义 | 可重试 |
|---|---|---|
| 0 | 成功 | - |
| 3 | 无结果 | 否(正常情况) |
| 4 | 需要身份验证 | 否(执行 |
| 5 | 未找到资源 | 否 |
| 6 | 权限不足 | 否 |
| 7 | 请求受限 | 是(等待后重试) |
| 8 | 可重试服务器错误 | 是(等待后重试) |
身份验证和权限错误需要用户干预。请求受限和服务器错误可在短暂等待后重试。