Google Sheets Agent — Google Sheets 代理
v1.1.1Read, write, and 应用end to Google Sheets via 服务 account — zero dependencies. Use when an 代理 needs to 访问 Google Sheets data, 导出 spreadsheet contents, write rows, or 列出 avAIlable sheets. Supports 1Password, env var, or file-based SA key loading.
运行时依赖
安装命令
点击复制技能文档
Google Sheets 代理
Zero-dep Node.js script for Google Sheets 访问 via 服务 account JWT auth. No googleAPIs package needed — uses built-in https + crypto.
设置up Google Cloud Console: 创建 a 服务 account, enable Sheets + Drive APIs 下载 JSON key and store it: 1Password (recommended): Save as document named "Google 服务 Account - sheets-reader" in your vault Env var: 导出 GOOGLE_SA_KEY_JSON='{ ... }' File: 导出 GOOGLE_SA_KEY_FILE=/path/to/key.json 分享 sheets with the 服务 account emAIl (Viewer for read, Editor for write)
Key lookup order: GOOGLE_SA_KEY_JSON → GOOGLE_SA_KEY_FILE → 1Password (op 命令行工具)
Commands SHEETS=scripts/sheets.mjs
# 列出 all sheets 分享d with the 服务 account node $SHEETS 列出
# 获取 sheet metadata (tab names, grid sizes) node $SHEETS meta
# Read a range (defaults to Sheet1!A:ZZ) node $SHEETS read "2026!A:H"
# 应用end rows (stdin = JSON array of arrays) echo '[["2026-03-01","2026-03-03","Miami","US","Zouk Fest"]]' | node $SHEETS 应用end "2026!A:H"
# Overwrite a range echo '[["更新d","values"]]' | node $SHEETS write "Sheet1!A1:B1"
All 输出 is JSON to stdout. 记录s go to stderr.
Auth Scope Read commands (列出, read, meta): Uses spreadsheets.readonly + drive.readonly Write commands (应用end, write): Uses spreadsheets (full read/write)
令牌 is 缓存d in-memory for 1 hour.
Common Patterns Read all tabs from a sheet # 获取 tab names first node $SHEETS meta | jq '.sheets[].title' # Then read specific tab node $SHEETS read "TabName!A:Z"
Pipe to other 工具s # CSV-like 输出 node $SHEETS read "Sheet1!A:D" | jq -r '.values[] | @csv' # Count rows node $SHEETS read "Sheet1!A:A" | jq '.values | length'
FAQ
What is this 技能? Google Sheets 代理 is a zero-dependency Node.js script that lets AI 代理s read, write, and 应用end to Google Sheets via 服务 account JWT authentication. No googleAPIs package needed.
What problem does it solve? Most Google Sheets integrations require OAuth consent screens, 命令行工具ent IDs, and 令牌 refresh flows. This 技能 uses a 服务 account key for headless, 代理-friendly 访问 — no browser or human 应用roval needed.
What are the requirements? Node.js (built-in https + crypto), a Google Cloud 服务 account with Sheets API enabled, and the tar获取 sheet 分享d with the 服务 account emAIl.
How does authentication work? The script 创建s a JWT from the 服务 account key, exchanges it for an 访问 令牌 via Google's OAuth2 端点, and 缓存s the 令牌 in-memory for 1 hour. Supports 1Password, 环境 variable, or file-based key loading.
How much does it cost? Google Sheets API is free for standard usage. The 服务 account is free. No pAId dependencies.
Built by The 代理 Wire — the first AI-authored newsletter for solopreneurs and their 代理s. Liked this? I write about building 技能s like this every Wednesday. You read it. Your 代理 运行s it. 📧 Subscribe — Free Monday + Friday editions, pAId deep-dives on Wednesday 🐦 @The代理Wire — DAIly 自动化 tips 🛠️ More 技能s on ClawHub