google-integration

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Google Integration

Google集成

Complete Google Workspace integration with unified OAuth authentication. One login grants access to Gmail, Google Docs, Google Sheets, Google Calendar, Google Drive, Google Tasks, and Google Slides.
实现与Google Workspace的完整集成,支持统一OAuth认证。一次登录即可访问Gmail、Google Docs、Google Sheets、Google Calendar、Google Drive、Google Tasks和Google Slides。

Purpose

用途

Provides a unified interface to Google Workspace services with:
  • Single authentication - Login once, use all services
  • Shared credentials - One OAuth setup for everything
  • Consistent patterns - Same error handling across all services
提供一个统一的Google Workspace服务界面,具备以下特性:
  • 单点认证 - 一次登录,使用所有服务
  • 共享凭据 - 一套OAuth配置适用于所有服务
  • 一致模式 - 所有服务采用相同的错误处理机制

Included Services

包含的服务

ServiceDescriptionOperations
GmailEmail operationsRead, send, reply, forward, drafts, labels
Google DocsDocument operationsRead, write, create, export, format
Google SheetsSpreadsheet operationsRead, write, append, create, format
Google CalendarCalendar operationsList events, create, update, find slots, check availability
Google DriveFile storage operationsUpload, download, share, organize folders
Google TasksTask managementCreate, complete, organize task lists
Google SlidesPresentation operationsCreate, edit slides, add text/images, export

服务描述操作
Gmail邮件操作读取、发送、回复、转发、草稿、标签管理
Google Docs文档操作读取、写入、创建、导出、格式设置
Google Sheets电子表格操作读取、写入、追加、创建、格式设置
Google Calendar日历操作列出事件、创建、更新、查找时段、检查可用性
Google Drive文件存储操作上传、下载、共享、文件夹管理
Google Tasks任务管理创建、完成、任务列表管理
Google Slides演示文稿操作创建、编辑幻灯片、添加文本/图片、导出

First-Time Setup

首次设置

New users: Say
"connect google"
to run the interactive setup wizard.
The wizard guides you through:
  1. Creating a Google Cloud project
  2. Enabling required APIs
  3. Creating OAuth credentials
  4. Authenticating with your Google account

新用户:说出
"connect google"
即可运行交互式设置向导。
向导将引导您完成以下步骤:
  1. 创建Google Cloud项目
  2. 启用所需API
  3. 创建OAuth凭据
  4. 使用您的Google账号进行认证

Pre-Flight Check (ALWAYS RUN FIRST)

预检检查(务必先运行)

bash
python3 00-system/skills/google/google-master/scripts/check_google_config.py --json
Exit codes:
  • 0: Ready - all services available
  • 1: Need login - run the login command below
  • 2: Missing credentials or dependencies
To authenticate (grants access to ALL services):
bash
python3 00-system/skills/google/google-master/scripts/google_auth.py --login

bash
python3 00-system/skills/google/google-master/scripts/check_google_config.py --json
退出码说明:
  • 0:就绪 - 所有服务可用
  • 1:需要登录 - 运行下方的登录命令
  • 2:缺少凭据或依赖项
进行认证(获取所有服务的访问权限):
bash
python3 00-system/skills/google/google-master/scripts/google_auth.py --login

Quick Start by Service

按服务快速开始

Gmail

Gmail

bash
undefined
bash
undefined

List recent emails

列出最近的邮件

python3 00-system/skills/google/gmail/scripts/gmail_operations.py list --max 10
python3 00-system/skills/google/gmail/scripts/gmail_operations.py list --max 10

Send email (creates draft first, asks for confirmation)

发送邮件(先创建草稿,需确认)

python3 00-system/skills/google/gmail/scripts/gmail_operations.py send --to "user@example.com" --subject "Hello" --body "Message"
undefined
python3 00-system/skills/google/gmail/scripts/gmail_operations.py send --to "user@example.com" --subject "Hello" --body "Message"
undefined

Google Docs

Google Docs

bash
undefined
bash
undefined

Read document

读取文档

python3 00-system/skills/google/google-docs/scripts/docs_operations.py read <document_id>
python3 00-system/skills/google/google-docs/scripts/docs_operations.py read <document_id>

Create document

创建文档

python3 00-system/skills/google/google-docs/scripts/docs_operations.py create "My Document" --content "Initial content"
undefined
python3 00-system/skills/google/google-docs/scripts/docs_operations.py create "My Document" --content "Initial content"
undefined

Google Sheets

Google Sheets

bash
undefined
bash
undefined

Read data

读取数据

python3 00-system/skills/google/google-sheets/scripts/sheets_operations.py read <spreadsheet_id> "Sheet1!A1:D10"
python3 00-system/skills/google/google-sheets/scripts/sheets_operations.py read <spreadsheet_id> "Sheet1!A1:D10"

Append rows

追加行

python3 00-system/skills/google/google-sheets/scripts/sheets_operations.py append <spreadsheet_id> "Sheet1!A:D" --values '[["New", "Row", "Data"]]'
undefined
python3 00-system/skills/google/google-sheets/scripts/sheets_operations.py append <spreadsheet_id> "Sheet1!A:D" --values '["New", "Row", "Data"]'
undefined

Google Calendar

Google Calendar

bash
undefined
bash
undefined

List upcoming events

列出即将到来的事件

python3 00-system/skills/google/google-calendar/scripts/calendar_operations.py list --max 10
python3 00-system/skills/google/google-calendar/scripts/calendar_operations.py list --max 10

Find available slots

查找可用时段

python3 00-system/skills/google/google-calendar/scripts/calendar_operations.py find-slots --duration 30 --from "2025-12-16" --to "2025-12-20"
undefined
python3 00-system/skills/google/google-calendar/scripts/calendar_operations.py find-slots --duration 30 --from "2025-12-16" --to "2025-12-20"
undefined

Google Drive

Google Drive

bash
undefined
bash
undefined

List files in root

列出根目录下的文件

python3 00-system/skills/google/google-drive/scripts/drive_operations.py list
python3 00-system/skills/google/google-drive/scripts/drive_operations.py list

Upload file

上传文件

python3 00-system/skills/google/google-drive/scripts/drive_operations.py upload ./local_file.pdf
python3 00-system/skills/google/google-drive/scripts/drive_operations.py upload ./local_file.pdf

Download file

下载文件

python3 00-system/skills/google/google-drive/scripts/drive_operations.py download <file_id> --output ./downloaded.pdf
undefined
python3 00-system/skills/google/google-drive/scripts/drive_operations.py download <file_id> --output ./downloaded.pdf
undefined

Google Tasks

Google Tasks

bash
undefined
bash
undefined

List tasks

列出任务

python3 00-system/skills/google/google-tasks/scripts/tasks_operations.py tasks
python3 00-system/skills/google/google-tasks/scripts/tasks_operations.py tasks

Create task

创建任务

python3 00-system/skills/google/google-tasks/scripts/tasks_operations.py create "Call John" --due 2025-12-20
python3 00-system/skills/google/google-tasks/scripts/tasks_operations.py create "Call John" --due 2025-12-20

Complete task

完成任务

python3 00-system/skills/google/google-tasks/scripts/tasks_operations.py complete <task_id>
undefined
python3 00-system/skills/google/google-tasks/scripts/tasks_operations.py complete <task_id>
undefined

Google Slides

Google Slides

bash
undefined
bash
undefined

List presentations

列出演示文稿

python3 00-system/skills/google/google-slides/scripts/slides_operations.py list
python3 00-system/skills/google/google-slides/scripts/slides_operations.py list

Create presentation

创建演示文稿

python3 00-system/skills/google/google-slides/scripts/slides_operations.py create "Q4 Report"
python3 00-system/skills/google/google-slides/scripts/slides_operations.py create "Q4 Report"

Export to PDF

导出为PDF

python3 00-system/skills/google/google-slides/scripts/slides_operations.py export <presentation_id> ./report.pdf

---
python3 00-system/skills/google/google-slides/scripts/slides_operations.py export <presentation_id> ./report.pdf

---

Structure

结构

google/
├── SKILL.md                          # This file (bundle overview)
├── google-connect/                   # Setup wizard (say "connect google")
│   └── SKILL.md                      # Interactive setup workflow
├── google-master/                    # Shared resources (DO NOT load directly)
│   ├── SKILL.md                      # Documentation for shared resources
│   ├── scripts/
│   │   ├── google_auth.py            # Unified OAuth for all services
│   │   └── check_google_config.py    # Pre-flight validation
│   └── references/
│       ├── setup-guide.md            # Complete setup instructions
│       └── error-handling.md         # Common errors and solutions
├── gmail/
│   ├── SKILL.md                      # Gmail-specific docs
│   └── scripts/gmail_operations.py
├── google-docs/
│   ├── SKILL.md                      # Docs-specific docs
│   └── scripts/docs_operations.py
├── google-sheets/
│   ├── SKILL.md                      # Sheets-specific docs
│   └── scripts/sheets_operations.py
├── google-calendar/
│   ├── SKILL.md                      # Calendar-specific docs
│   └── scripts/calendar_operations.py
├── google-drive/
│   ├── SKILL.md                      # Drive-specific docs
│   └── scripts/drive_operations.py
├── google-tasks/
│   ├── SKILL.md                      # Tasks-specific docs
│   └── scripts/tasks_operations.py
└── google-slides/
    ├── SKILL.md                      # Slides-specific docs
    └── scripts/slides_operations.py

google/
├── SKILL.md                          # 本文件(集成概览)
├── google-connect/                   # 设置向导(说出"connect google")
│   └── SKILL.md                      # 交互式设置流程
├── google-master/                    # 共享资源(请勿直接加载)
│   ├── SKILL.md                      # 共享资源文档
│   ├── scripts/
│   │   ├── google_auth.py            # 所有服务的统一OAuth认证
│   │   └── check_google_config.py    # 预检验证
│   └── references/
│       ├── setup-guide.md            # 完整设置说明
│       └── error-handling.md         # 常见错误及解决方案
├── gmail/
│   ├── SKILL.md                      # Gmail专属文档
│   └── scripts/gmail_operations.py
├── google-docs/
│   ├── SKILL.md                      # Docs专属文档
│   └── scripts/docs_operations.py
├── google-sheets/
│   ├── SKILL.md                      # Sheets专属文档
│   └── scripts/sheets_operations.py
├── google-calendar/
│   ├── SKILL.md                      # Calendar专属文档
│   └── scripts/calendar_operations.py
├── google-drive/
│   ├── SKILL.md                      # Drive专属文档
│   └── scripts/drive_operations.py
├── google-tasks/
│   ├── SKILL.md                      # Tasks专属文档
│   └── scripts/tasks_operations.py
└── google-slides/
│   ├── SKILL.md                      # Slides专属文档
│   └── scripts/slides_operations.py

Setup

设置步骤

Prerequisites

前置依赖

bash
pip install google-auth google-auth-oauthlib google-api-python-client
bash
pip install google-auth google-auth-oauthlib google-api-python-client

1. Create Google Cloud Project

1. 创建Google Cloud项目

  1. Go to Google Cloud Console
  2. Create or select a project
  3. Enable APIs: Gmail, Docs, Sheets, Calendar, Drive, Tasks, Slides
  1. 访问Google Cloud Console
  2. 创建或选择一个项目
  3. 启用API:Gmail、Docs、Sheets、Calendar、Drive、Tasks、Slides

2. Create OAuth Credentials

2. 创建OAuth凭据

  1. Go to APIs & Services > Credentials
  2. Create OAuth 2.0 Client ID (Desktop app)
  3. Copy the Client ID and Client Secret
  4. Add to
    .env
    file (at Nexus root):
    GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
    GOOGLE_CLIENT_SECRET=your-client-secret
    GOOGLE_PROJECT_ID=your-project-id
  1. 进入API与服务 > 凭据
  2. 创建OAuth 2.0客户端ID(桌面应用)
  3. 复制客户端ID客户端密钥
  4. 添加到根目录的
    .env
    文件中:
    GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
    GOOGLE_CLIENT_SECRET=your-client-secret
    GOOGLE_PROJECT_ID=your-project-id

3. Authenticate

3. 进行认证

bash
python3 00-system/skills/google/google-master/scripts/google_auth.py --login
This opens a browser to grant permissions for all services at once.
For detailed setup: google-master/references/setup-guide.md

bash
python3 00-system/skills/google/google-master/scripts/google_auth.py --login
这将打开浏览器,一次性授予所有服务的权限。
详细设置说明:google-master/references/setup-guide.md

Error Handling

错误处理

See google-master/references/error-handling.md for:
  • Authentication errors (401, 403)
  • Rate limiting (429)
  • Permission issues
  • Token refresh problems

请查看google-master/references/error-handling.md了解:
  • 认证错误(401、403)
  • 速率限制(429)
  • 权限问题
  • 令牌刷新问题

File Locations

文件位置

FilePathPurpose
OAuth credentials
.env
(GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_PROJECT_ID)
App identity
Access token
01-memory/integrations/google-token.json
User's auth token
Both
.env
and token file are in
.gitignore
and will not be committed.

文件路径用途
OAuth凭据
.env
(GOOGLE_CLIENT_ID、GOOGLE_CLIENT_SECRET、GOOGLE_PROJECT_ID)
应用身份标识
访问令牌
01-memory/integrations/google-token.json
用户的认证令牌
.env
和令牌文件均已加入
.gitignore
,不会被提交到版本库。

Security Notes

安全说明

  • Credentials (
    .env
    file) - in
    .gitignore
    , never committed
  • Token file (
    google-token.json
    ) - in
    .gitignore
    , never committed
  • Each user authenticates with their own Google account
  • 凭据
    .env
    文件)- 已加入
    .gitignore
    ,切勿提交
  • 令牌文件
    google-token.json
    )- 已加入
    .gitignore
    ,切勿提交
  • 每个用户使用自己的Google账号进行认证