google-docs-automation

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Google Docs

Google Docs

Lightweight Google Docs integration with standalone OAuth authentication. No MCP server required.
⚠️ Requires Google Workspace account. Personal Gmail accounts are not supported.
轻量级Google Docs集成,自带独立OAuth身份认证,无需MCP服务器。
⚠️ 要求使用Google Workspace账号。 不支持个人Gmail账号。

First-Time Setup

首次设置

Authenticate with Google (opens browser):
bash
python scripts/auth.py login
Check authentication status:
bash
python scripts/auth.py status
Logout when needed:
bash
python scripts/auth.py logout
通过Google完成身份认证(会打开浏览器):
bash
python scripts/auth.py login
检查认证状态:
bash
python scripts/auth.py status
需要时登出:
bash
python scripts/auth.py logout

Commands

命令

All operations via
scripts/docs.py
. Auto-authenticates on first use if not logged in.
bash
undefined
所有操作均通过
scripts/docs.py
执行。如果未登录,首次使用时会自动完成认证。
bash
undefined

Create a new document

Create a new document

python scripts/docs.py create "Meeting Notes"
python scripts/docs.py create "Meeting Notes"

Create a document with initial content

Create a document with initial content

python scripts/docs.py create "Project Plan" --content "# Overview\n\nThis is the project plan."
python scripts/docs.py create "Project Plan" --content "# Overview\n\nThis is the project plan."

Find documents by title

Find documents by title

python scripts/docs.py find "meeting" --limit 10
python scripts/docs.py find "meeting" --limit 10

Get text content of a document

Get text content of a document

python scripts/docs.py get-text 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms
python scripts/docs.py get-text 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms

Get text using a full URL

Get text using a full URL

Append text to end of document

Append text to end of document

python scripts/docs.py append-text 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms "New paragraph at the end."
python scripts/docs.py append-text 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms "New paragraph at the end."

Insert text at beginning of document

Insert text at beginning of document

python scripts/docs.py insert-text 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms "Text at the beginning.\n\n"
python scripts/docs.py insert-text 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms "Text at the beginning.\n\n"

Replace text in document

Replace text in document

python scripts/docs.py replace-text 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms "old text" "new text"
undefined
python scripts/docs.py replace-text 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms "old text" "new text"
undefined

Document ID Format

文档ID格式

Google Docs uses document IDs like
1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms
. You can:
  • Use the full URL (the ID will be extracted automatically)
  • Use just the document ID
  • Get document IDs from the
    find
    command results
Google Docs使用的文档ID格式如
1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms
。你可以:
  • 使用完整URL(ID会被自动提取)
  • 仅使用文档ID
  • find
    命令的结果中获取文档ID

Token Management

令牌管理

Tokens stored securely using the system keyring:
  • macOS: Keychain
  • Windows: Windows Credential Locker
  • Linux: Secret Service API (GNOME Keyring, KDE Wallet, etc.)
Service name:
google-docs-skill-oauth
Access tokens are automatically refreshed when expired using Google's cloud function.
令牌通过系统密钥环安全存储:
  • macOS: Keychain
  • Windows: Windows Credential Locker
  • Linux: Secret Service API(GNOME Keyring、KDE Wallet等)
服务名称:
google-docs-skill-oauth
访问令牌过期时会通过Google云函数自动刷新。