google

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Google Workspace Skill

Google Workspace 技能

This skill provides Google Workspace integration using the
gog
CLI (gogcli). The agent calls
gog
directly for all operations.
本技能通过
gog
CLI工具(gogcli)实现Google Workspace集成。Agent会直接调用
gog
执行所有操作。

Prerequisites

前置条件

Install the
gog
binary:
bash
undefined
安装
gog
二进制文件:
bash
undefined

Homebrew

Homebrew

brew install openclaw/tap/gogcli
brew install openclaw/tap/gogcli

Manual (Linux amd64)

手动安装(Linux amd64)


See [configuration.md](references/configuration.md) for container and MCP server alternatives.

如需容器和MCP服务器替代方案,请查看[configuration.md](references/configuration.md)。

Authentication

身份验证

bash
undefined
bash
undefined

Import 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
undefined
gog auth doctor
undefined

Migrating 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 cleanup
Then 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 metadata
All commands support
--json
for structured output and
--plain
for TSV.
bash
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>                # 获取演示文稿元数据
所有命令均支持
--json
参数以输出结构化数据,支持
--plain
参数以输出TSV格式数据。

Commands

命令列表

Check Setup

检查设置

bash
$SKILL_DIR/scripts/google.py check
bash
$SKILL_DIR/scripts/google.py check

Gmail

Gmail

bash
undefined
bash
undefined

Search

搜索

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
undefined
bash
undefined

View

查看

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
undefined
bash
undefined

Browse

浏览

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
undefined
bash
undefined

Read

读取

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
undefined
bash
undefined

Read

读取

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
undefined
bash
undefined

Read

读取

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"; done
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"; done

Check 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
undefined
bash
undefined

JSON 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"
undefined
gog gmail search "is:unread" --json --select "id,subject,from"
undefined

Agent Safety

Agent安全设置

bash
undefined
bash
undefined

Read-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"
undefined
gog --no-input calendar create primary --summary "Test"
undefined

Error Handling

错误处理

Exit CodeMeaningRetryable
0Success-
3Empty resultsNo (normal)
4Auth requiredNo (run
gog auth setup
)
5Not foundNo
6Permission deniedNo
7Rate limitedYes (wait and retry)
8Retryable server errorYes (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需要身份验证否(执行
gog auth setup
5未找到资源
6权限不足
7请求受限是(等待后重试)
8可重试服务器错误是(等待后重试)
身份验证和权限错误需要用户干预。请求受限和服务器错误可在短暂等待后重试。