一键导入
google-sheets
This skill should be used when the user asks to read, create, or edit Google Sheets spreadsheets, or manage cell data through the Google Sheets API.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
This skill should be used when the user asks to read, create, or edit Google Sheets spreadsheets, or manage cell data through the Google Sheets API.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Enforces explicit user approval before implementing any plan. Use when presenting a plan, receiving plan feedback, or about to delegate implementation.
CharlieBot repo structure, architecture, and development conventions. Use when modifying charlie-bot code.
How to write effective improve loop goal prompts — for the master CC agent that writes the --goal-file content.
methodology for iterative improve loop workers.
CharlieBot skill directory layout, sync rules, and CLI tool mappings. Use when creating, installing, or syncing skills across Claude Code, Codex, Gemini, OpenCode, and Antigravity.
This skill should be used when the user asks to read, create, or edit Feishu/Lark documents, search docs in their Feishu workspace, or fetch content from a Feishu wiki or docx URL.
| name | google-sheets |
| description | This skill should be used when the user asks to read, create, or edit Google Sheets spreadsheets, or manage cell data through the Google Sheets API. |
| version | 1.0.0 |
Read, create, and edit Google Sheets using the Sheets API v4 with a user refresh token.
IMPORTANT: User approval required for all writes. Before any create, update, append, or batch update action, show the planned content first and wait for explicit take off approval. Do not mutate anything before that approval.
~/.charliebot/config.yamlgoogle_client_idgoogle_client_secretgoogle_refresh_tokengoogle_refresh_token in config. Access tokens are minted at runtime and discarded after use.All Google API requests use:
-H "Authorization: Bearer $ACCESS_TOKEN"
-H "Content-Type: application/json"
Read the configured values before making any calls.
Use the Google OAuth token endpoint at runtime:
# Read credentials (uses python3+pyyaml; yq may not be installed)
read GOOGLE_CLIENT_ID GOOGLE_CLIENT_SECRET GOOGLE_REFRESH_TOKEN < <(python3 -c "
import yaml
c = yaml.safe_load(open('$HOME/.charliebot/config.yaml'))
print(c['google_client_id'], c['google_client_secret'], c['google_refresh_token'])
")
ACCESS_TOKEN=$(curl -s -X POST https://oauth2.googleapis.com/token \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "client_id=$GOOGLE_CLIENT_ID" \
--data-urlencode "client_secret=$GOOGLE_CLIENT_SECRET" \
--data-urlencode "refresh_token=$GOOGLE_REFRESH_TOKEN" \
--data-urlencode "grant_type=refresh_token" | jq -r '.access_token')
If the refresh token is invalid or revoked, re-run the bootstrap flow below.
curl -s -X POST https://sheets.googleapis.com/v4/spreadsheets \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"properties":{"title":"Spreadsheet Title"}}'
After a successful create, return the editor URL:
https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit
curl -s "https://sheets.googleapis.com/v4/spreadsheets/SPREADSHEET_ID" \
-H "Authorization: Bearer $ACCESS_TOKEN"
Returns spreadsheet properties, sheet names, grid dimensions, and other metadata. To list only sheet titles, inspect sheets[].properties.title in the response.
curl -s "https://sheets.googleapis.com/v4/spreadsheets/SPREADSHEET_ID/values/RANGE" \
-H "Authorization: Bearer $ACCESS_TOKEN"
RANGE uses A1 notation, e.g. Sheet1!A1:D10 or Sheet1!A:A. The response contains a values array of rows.
curl -s -X PUT "https://sheets.googleapis.com/v4/spreadsheets/SPREADSHEET_ID/values/RANGE?valueInputOption=USER_ENTERED" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"range": "RANGE",
"majorDimension": "ROWS",
"values": [
["A1 value", "B1 value"],
["A2 value", "B2 value"]
]
}'
valueInputOption=USER_ENTERED parses values as if typed into the UI (numbers, dates, formulas are interpreted). Use RAW to store literal strings.
curl -s -X POST "https://sheets.googleapis.com/v4/spreadsheets/SPREADSHEET_ID/values/RANGE:append?valueInputOption=USER_ENTERED" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"range": "RANGE",
"majorDimension": "ROWS",
"values": [
["A value", "B value"]
]
}'
Appends rows after the last row with data in the specified range. The RANGE determines which table to append to (e.g. Sheet1!A:B).
Use spreadsheets.batchUpdate for structural changes (add/delete sheets, formatting, merge cells, resize, conditional formatting, etc.):
curl -s -X POST "https://sheets.googleapis.com/v4/spreadsheets/SPREADSHEET_ID:batchUpdate" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"requests": [
{
"addSheet": {
"properties": { "title": "New Sheet" }
}
}
]
}'
Common request types: addSheet, deleteSheet, updateSheetProperties, mergeCells, repeatCell (for formatting), autoResizeDimensions, addConditionalFormatRule.
All Google integrations (Gmail, Docs, Sheets, Drive, Calendar) share a single OAuth client and refresh token stored under the unified google_* config keys.
One-time setup to obtain a refresh token for the desktop-app OAuth flow:
redirect_uri=http://localhost (not http://127.0.0.1:PORT):response_type=code
client_id=CLIENT_ID
redirect_uri=http://localhost
scope=https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/documents https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/calendar
access_type=offline
prompt=consent
code from the redirect, and exchange it for tokens:curl -s -X POST https://oauth2.googleapis.com/token \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "client_id=CLIENT_ID" \
--data-urlencode "client_secret=CLIENT_SECRET" \
--data-urlencode "code=AUTH_CODE" \
--data-urlencode "grant_type=authorization_code" \
--data-urlencode "redirect_uri=http://localhost"
refresh_token to google_refresh_token in ~/.charliebot/config.yaml.Note: If the GCP project is in Testing mode, the refresh token expires in ~7 days. Publish the OAuth consent screen to Production for non-expiring tokens.
~/.charliebot/config.yaml.spreadsheets.get for metadata or spreadsheets.values.get for cell data.take off approval.https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit.