google-sheets
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGoogle Sheets
Google Sheets
Lightweight Google Sheets integration with standalone OAuth authentication. No MCP server required. Read-only access.
⚠️ Requires Google Workspace account. Personal Gmail accounts are not supported.
轻量级Google Sheets集成,采用独立OAuth认证,无需MCP服务器,仅支持只读访问。
⚠️ 需使用Google Workspace账户,个人Gmail账户不被支持。
First-Time Setup
首次设置
Authenticate with Google (opens browser):
bash
python scripts/auth.py loginCheck authentication status:
bash
python scripts/auth.py statusLogout 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 logoutCommands
命令
All operations via . Auto-authenticates on first use if not logged in.
scripts/sheets.pybash
undefined所有操作通过执行。若未登录,首次使用时将自动完成认证。
scripts/sheets.pybash
undefinedGet spreadsheet content as plain text (default)
获取电子表格内容为纯文本格式(默认)
python scripts/sheets.py get-text SPREADSHEET_ID
python scripts/sheets.py get-text SPREADSHEET_ID
Get spreadsheet content as CSV
获取电子表格内容为CSV格式
python scripts/sheets.py get-text SPREADSHEET_ID --format csv
python scripts/sheets.py get-text SPREADSHEET_ID --format csv
Get spreadsheet content as JSON
获取电子表格内容为JSON格式
python scripts/sheets.py get-text SPREADSHEET_ID --format json
python scripts/sheets.py get-text SPREADSHEET_ID --format json
Get values from a specific range (A1 notation)
获取特定范围的值(A1表示法)
python scripts/sheets.py get-range SPREADSHEET_ID "Sheet1!A1:D10"
python scripts/sheets.py get-range SPREADSHEET_ID "A1:C5"
python scripts/sheets.py get-range SPREADSHEET_ID "Sheet1!A1:D10"
python scripts/sheets.py get-range SPREADSHEET_ID "A1:C5"
Find spreadsheets by search query
根据搜索关键词查找电子表格
python scripts/sheets.py find "budget 2024"
python scripts/sheets.py find "sales report" --limit 5
python scripts/sheets.py find "budget 2024"
python scripts/sheets.py find "sales report" --limit 5
Get spreadsheet metadata (sheets, dimensions, etc.)
获取电子表格元数据(工作表、维度等)
python scripts/sheets.py get-metadata SPREADSHEET_ID
undefinedpython scripts/sheets.py get-metadata SPREADSHEET_ID
undefinedSpreadsheet ID
电子表格ID
You can use either:
- The spreadsheet ID:
1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms - The full URL:
https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
The script automatically extracts the ID from URLs.
你可以使用以下两种形式之一:
- 电子表格ID:
1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms - 完整URL:
https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
脚本会自动从URL中提取ID。
Output Formats
输出格式
Text (default)
文本(默认)
Human-readable format with pipe separators:
Spreadsheet Title: Sales Data
Sheet Name: Q1
Name | Revenue | Units
Product A | 10000 | 50
Product B | 15000 | 75带管道分隔符的易读格式:
Spreadsheet Title: Sales Data
Sheet Name: Q1
Name | Revenue | Units
Product A | 10000 | 50
Product B | 15000 | 75CSV
CSV
Standard CSV format, suitable for further processing:
Name,Revenue,Units
Product A,10000,50
Product B,15000,75标准CSV格式,适合后续处理:
Name,Revenue,Units
Product A,10000,50
Product B,15000,75JSON
JSON
Structured data format:
json
{
"Q1": [
["Name", "Revenue", "Units"],
["Product A", "10000", "50"]
]
}结构化数据格式:
json
{
"Q1": [
["Name", "Revenue", "Units"],
["Product A", "10000", "50"]
]
}A1 Notation Examples
A1表示法示例
- - Range A1 to B10 on Sheet1
Sheet1!A1:B10 - - All of column A on Sheet1
Sheet1!A:A - - All of row 1 on Sheet1
Sheet1!1:1 - - Range on the first sheet
A1:C5
- - Sheet1工作表中A1到B10的范围
Sheet1!A1:B10 - - Sheet1工作表中的A列全部内容
Sheet1!A:A - - Sheet1工作表中的第1行全部内容
Sheet1!1:1 - - 第一个工作表中的A1到C5范围
A1:C5
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-sheets-skill-oauthTokens automatically refresh when expired using Google's cloud function.
令牌通过系统密钥环安全存储:
- macOS:Keychain(钥匙串)
- Windows:Windows凭据管理器
- Linux:Secret Service API(GNOME Keyring、KDE Wallet等)
服务名称:
google-sheets-skill-oauth令牌过期时将通过Google云函数自动刷新。