gsheets

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Google Sheets Skill

Google Sheets Skill

Create, read, write, and manage Google Sheets spreadsheets.
创建、读取、写入和管理Google Sheets电子表格。

First-Time Setup

首次设置

Run
npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gmail.ts auth
to authenticate with Google. This opens a browser for OAuth consent and grants access to all Google services including Sheets.
Tokens are stored per-project in
.claude/google-skill.local.json
.
运行
npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gmail.ts auth
进行Google身份验证。这会打开浏览器进行OAuth授权,并授予对包括Sheets在内的所有Google服务的访问权限。
令牌按项目存储在
.claude/google-skill.local.json
中。

Using Your Own Credentials (Optional)

使用自有凭证(可选)

By default, this skill uses embedded OAuth credentials. To use your own Google Cloud project instead, save your credentials to
~/.config/google-skill/credentials.json
.
默认情况下,此Skill使用内置的OAuth凭证。如果要改用您自己的Google Cloud项目,请将凭证保存到
~/.config/google-skill/credentials.json

Commands

命令

bash
undefined
bash
undefined

List your spreadsheets

列出您的电子表格

npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts list npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts list --max=50
npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts list npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts list --max=50

Get spreadsheet metadata (title, sheets, etc.)

获取电子表格元数据(标题、工作表等)

npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts get <spreadsheetId>
npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts get <spreadsheetId>

Read cell values (A1 notation)

读取单元格值(A1表示法)

npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts read <spreadsheetId> "Sheet1!A1:D10"
npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts read <spreadsheetId> "Sheet1!A1:D10"

Write values to cells

向单元格写入值

npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts write <spreadsheetId> "Sheet1!A1"
--values='[["Hello","World"],["Row 2","Data"]]'
npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts write <spreadsheetId> "Sheet1!A1"
--values='[["Hello","World"],["Row 2","Data"]]'

Append rows to end of sheet

向表格末尾追加行

npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts append <spreadsheetId> "Sheet1!A:D"
--values='[["New","Row","Data"]]'
npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts append <spreadsheetId> "Sheet1!A:D"
--values='[["New","Row","Data"]]'

Clear a range

清除指定范围

npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts clear <spreadsheetId> "Sheet1!A1:D10"
npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts clear <spreadsheetId> "Sheet1!A1:D10"

Create new spreadsheet

创建新电子表格

npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts create --title="My Spreadsheet" npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts create --title="Project Data" --sheets="Q1,Q2,Q3,Q4"
npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts create --title="My Spreadsheet" npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts create --title="Project Data" --sheets="Q1,Q2,Q3,Q4"

Add new sheet/tab to existing spreadsheet

向现有电子表格添加新工作表/标签页

npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts add-sheet <spreadsheetId> --title="New Tab"
undefined
npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts add-sheet <spreadsheetId> --title="New Tab"
undefined

A1 Notation Reference

A1表示法参考

NotationMeaning
Sheet1!A1
Single cell A1 in Sheet1
Sheet1!A1:D10
Range from A1 to D10
Sheet1!A:D
Columns A through D (all rows)
Sheet1!1:10
Rows 1 through 10 (all columns)
A1:D10
Range in first sheet
表示法含义
Sheet1!A1
Sheet1中的单个单元格A1
Sheet1!A1:D10
从A1到D10的范围
Sheet1!A:D
A到D列(所有行)
Sheet1!1:10
1到10行(所有列)
A1:D10
第一个工作表中的范围

Values Format

值格式

Values are JSON arrays of arrays:
json
[
  ["Header 1", "Header 2", "Header 3"],
  ["Row 1", 123, true],
  ["Row 2", 456, false]
]
Supported value types: strings, numbers, booleans, null (empty cell).
值为JSON数组的数组:
json
[
  ["Header 1", "Header 2", "Header 3"],
  ["Row 1", 123, true],
  ["Row 2", 456, false]
]
支持的值类型:字符串、数字、布尔值、null(空单元格)。

Output

输出

All commands return JSON with
success
and
data
fields.
所有命令都会返回包含
success
data
字段的JSON。

Help

帮助

bash
npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts --help
bash
npx tsx ${CLAUDE_PLUGIN_ROOT}/scripts/gsheets.ts --help