/install logger
porteden sheets-logger
Append log entries to a Google Sheet with porteden sheets. This skill configures a target log spreadsheet via environment variable so agents can record events, activity logs, and audit trails without repeating the file ID. Use -jc flags for AI-optimized output.
If porteden is not installed: brew install porteden/tap/porteden (or go install github.com/porteden/cli/cmd/porteden@latest).
Setup
1. Authenticate (once)
- Browser login (recommended):
porteden auth login— opens browser, credentials stored in system keyring - Direct token:
porteden auth login --token \x3Ckey>— stored in system keyring - Verify:
porteden auth status - If
PE_API_KEYis set in the environment, the CLI uses it automatically (no login needed). - Drive access requires a token with
driveAccessEnabled: trueand a connected Google account with Drive scopes.
2. Set the target log sheet (one-time)
If PE_SHEET_ID is already set, skip to step 3 — the target sheet is configured.
If PE_SHEET_ID is not set, find the spreadsheet by name:
porteden drive files -q "Activity Log" --mime-type application/vnd.google-apps.spreadsheet -jc
Copy the id field from the result (already provider-prefixed, e.g., google:1BxiMVs0XRA5...) and set it:
export PE_SHEET_ID="google:1BxiMVs0XRA5nFMdKvBdBZjgmU..."
To persist across sessions, add to your shell profile (~/.bashrc, ~/.zshrc) or .env file. Once set, this step does not need to be repeated.
3. Test the connection (one-time)
porteden sheets info $PE_SHEET_ID -jc
Expected: returns spreadsheet title, sheet tabs, and dimensions. If this fails, verify the file ID and that your token has Drive access. Once verified, skip this step in future runs.
4. Read the header row (one-time)
Before logging, confirm the column layout of the target sheet:
porteden sheets read $PE_SHEET_ID --range "Sheet1!1:1" -jc
Match your log entries to this column order. Once you know the schema, skip this step in future runs.
Logging data
Append a log entry
Append adds rows after the last row with data. Existing log entries are never overwritten.
-
Single log entry:
porteden sheets append $PE_SHEET_ID --range "Sheet1!A:E" --values '[["2025-01-15T09:30:00Z","deploy","production","v2.4.1 released","success"]]' -
Multiple log entries (batch):
porteden sheets append $PE_SHEET_ID --range "Sheet1!A:E" --values '[["2025-01-15T09:30:00Z","deploy","production","v2.4.1 released","success"],["2025-01-15T09:31:12Z","healthcheck","production","all endpoints healthy","success"]]' -
Log entry from CSV string:
porteden sheets append $PE_SHEET_ID --range "Sheet1!A:E" --csv "2025-01-15T09:30:00Z,deploy,production,v2.4.1 released,success" -
Bulk log import from CSV file:
porteden sheets append $PE_SHEET_ID --range "Sheet1!A:E" --csv-file ./events.csv
Verify logged entries
Read back recent rows to confirm the log was recorded:
porteden sheets read $PE_SHEET_ID --range "Sheet1" -jc
Log schema examples
Structure your log sheet with a header row. Common schemas:
Event log: Timestamp | Event | Source | Details | Status
Audit trail: Timestamp | Actor | Action | Resource | Before | After
Error log: Timestamp | Severity | Service | Message | Stack
Task log: Timestamp | Task | Agent | Input | Output | Duration
Best practices
- Always use append — logging is append-only by nature. Never use write to overwrite log entries.
- Include a timestamp in every entry — use ISO 8601 format (
2025-01-15T09:30:00Z) for sortability and consistency. - Use
--rawfor literal values — prevents unintended formula evaluation (e.g., log messages starting with=). - Batch entries when possible — send multiple rows in one
--valuesarray rather than one-row-at-a-time to reduce API calls. - Specify column range in append (e.g.,
A:Enot justA) — ensures data lands in the correct columns. - Read the header row first — confirm column order with
porteden sheets read $PE_SHEET_ID --range "Sheet1!1:1" -jcbefore appending. - Use
-jcon read/info — compact JSON output minimizes tokens for AI agents.
Range format
- Open-ended columns (for append):
Sheet1!A:E - Specific cells:
Sheet1!A1:E10 - Whole sheet:
Sheet1 - Header row only:
Sheet1!1:1
Notes
- Credentials persist in the system keyring after login. No repeated auth needed.
- Set
PE_PROFILE=workto avoid repeating--profile. -jcis shorthand for--json --compact: strips noise, limits fields, reduces tokens for AI agents.- File IDs are always provider-prefixed (e.g.,
google:1BxiMVs0XRA5...). Pass them as-is. --values,--csv, and--csv-fileare mutually exclusive — provide exactly one.--csvinline: use\as row separator (e.g.,"ts,event,src\ ts2,event2,src2").--rawflag disables formula evaluation (values written literally, not parsed as formulas).accessInfoin responses describes active token restrictions.- Environment variables:
PE_API_KEY,PE_PROFILE,PE_SHEET_ID,PE_FORMAT,PE_COLOR,PE_VERBOSE.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install logger - 安装完成后,直接呼叫该 Skill 的名称或使用
/logger触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Log Automation — Append log entries to Google Sheet 是什么?
Log Automation — Append log entries, record audit trails, and automate event logging to a pre-configured Google Sheet by PortEden Secure access. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 229 次。
如何安装 Log Automation — Append log entries to Google Sheet?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install logger」即可一键安装,无需额外配置。
Log Automation — Append log entries to Google Sheet 是免费的吗?
是的,Log Automation — Append log entries to Google Sheet 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Log Automation — Append log entries to Google Sheet 支持哪些平台?
Log Automation — Append log entries to Google Sheet 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Log Automation — Append log entries to Google Sheet?
由 PortEden(@porteden)开发并维护,当前版本 v1.0.0。