spreadsheet-peek
Preview spreadsheet/delimited files with the Spreadsheet Peek MCP viewer or `wolfxl peek`. Use proactively for .xlsx, .xlsm, .xls, .xlsb, .ods, .csv, .tsv, or .txt before processing, after fixture generation, during parsing debug, or when asked to peek/preview/show a file.
- License 许可
- MIT
- 最近更新
- 2026-08-31
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- spreadsheet-peek
- version
- 2.4.0
- metadata
- { "author": "wolfgangs", "bashPattern": [ "wolfxl", "peek\\b" ], "filePattern": [ "**/*.xlsx", "**/*.xls", "**/*.xlsm", "**/*.xlsb", "**/*.ods", "**/*.csv", "**/*.tsv", "**/*.txt" ] }
- description
- Preview spreadsheet/delimited files with the Spreadsheet Peek MCP viewer or `wolfxl peek`. Use proactively for .xlsx, .xlsm, .xls, .xlsb, .ods, .csv, .tsv, or .txt before processing, after fixture generation, during parsing debug, or when asked to peek/preview/show a file.
02 资源文件 78
- 参考文档.claude-plugin/marketplace.json1.1 KB
- 参考文档.claude-plugin/plugin.json614 B
- 参考文档.codex-plugin/marketplace.json940 B
- 参考文档.codex-plugin/plugin.json1.5 KB
- 参考文档.github/ISSUE_TEMPLATE/bug_report.yml1.7 KB
- 参考文档.github/ISSUE_TEMPLATE/config.yml462 B
- 参考文档.github/ISSUE_TEMPLATE/feature_request.yml1.5 KB
- 参考文档.github/ISSUE_TEMPLATE/question.yml584 B
- 参考文档.github/pull_request_template.md955 B
- 参考文档.github/workflows/benchmark.yml6.5 KB
- 参考文档.github/workflows/mcp-app.yml1.1 KB
- 其他.gitignore598 B
- 参考文档.mcp.json717 B
- 资产文件assets/agent-preview.gif267.5 KB
- 资产文件assets/contrast.gif193.4 KB
- 资产文件assets/og-card.png54.8 KB
- 资产文件assets/screencast.gif1011.0 KB
- 资产文件assets/screencast.mp41.1 MB
- 脚本benchmarks/compare_converters.py6.6 KB
- 脚本benchmarks/measure_tokens.py7.2 KB
- 参考文档benchmarks/README.md10.9 KB
- 脚本benchmarks/verify_claims.py9.0 KB
- 参考文档CHANGELOG.md24.0 KB
- 参考文档CLAUDE.md10.5 KB
- 参考文档CONTRIBUTING.md3.1 KB
- 参考文档docs/agent-setup.md12.2 KB
- 参考文档docs/how-it-works.md13.6 KB
- 参考文档docs/release-checklist.md2.3 KB
- 资产文件examples/demo.gif318.4 KB
- 其他examples/demo.tape1.0 KB
- 脚本examples/generate_delimited_samples.py2.1 KB
- 脚本examples/generate_messy_csv.py2.7 KB
- 脚本examples/generate_sample.py5.5 KB
- 脚本examples/generate_tall_ledger.py2.9 KB
- 脚本examples/generate_wide_table.py3.5 KB
- 资产文件examples/messy.csv396 B
- 资产文件examples/quoted-multiline.csv407 B
- 参考文档examples/README.md5.0 KB
- 其他examples/sample-date.xlsb7.5 KB
- 资产文件examples/sample-financials.xlsx8.4 KB
- 资产文件examples/sample-ledger.csv555 B
- 其他examples/sample-ledger.tsv555 B
- 参考文档examples/sample-ledger.txt555 B
- 其他examples/sample-minimal.ods1.6 KB
- 其他examples/sample-minimal.xls5.5 KB
- 资产文件examples/tall-ledger.xlsx10.1 KB
- 资产文件examples/wide-table.xlsx9.1 KB
- 脚本install.sh8.2 KB
- 许可证LICENSE1.1 KB
- 其他mcp-app/.mcpbignore114 B
- 脚本mcp-app/bin/run-server.mjs760 B
- 脚本mcp-app/bin/run-server.sh366 B
- 参考文档mcp-app/index.html310 B
- 参考文档mcp-app/manifest.json1.9 KB
- 参考文档mcp-app/package-lock.json102.6 KB
- 参考文档mcp-app/package.json1.4 KB
- 参考文档mcp-app/README.md3.0 KB
- 脚本mcp-app/scripts/chmod-server.mjs150 B
- 脚本mcp-app/scripts/strip-dist-whitespace.mjs308 B
- 脚本mcp-app/src/hostBridge.ts6.7 KB
- 脚本mcp-app/src/sampleData.ts2.7 KB
- 脚本mcp-app/src/server.ts4.9 KB
- 脚本mcp-app/src/tsv.ts426 B
- 脚本mcp-app/src/types.ts1.4 KB
- 脚本mcp-app/src/version.ts92 B
- 其他mcp-app/src/viewer.css8.9 KB
- 脚本mcp-app/src/viewer.ts18.4 KB
- 脚本mcp-app/src/workbook.ts11.4 KB
- 脚本mcp-app/test/viewer.test.ts23.1 KB
- 脚本mcp-app/test/workbook.test.ts5.7 KB
- 参考文档mcp-app/tsconfig.json372 B
- 脚本mcp-app/vite.config.ts337 B
- 参考文档README.md18.5 KB
- 脚本scripts/generate_og_card.py6.1 KB
- 脚本scripts/naive_preview.py310 B
- 脚本scripts/record_agent_preview.tape1.1 KB
- 脚本scripts/record_contrast.tape1.2 KB
- 脚本scripts/record_screencast.tape2.1 KB
03 SKILL.md 正文
Spreadsheet Peek
Show inline previews of spreadsheet files. Prefer the Spreadsheet Peek MCP viewer when available; otherwise use terminal wolfxl peek. This skill is proactive - invoke it at the right moments without waiting for the user to ask.
Prerequisites
wolfxlmust be installed:cargo install wolfxl-cliwolfxl-cli >= 0.9.0supports.xlsx,.xlsm,.xls,.xlsb,.ods,.csv,.tsv, and comma-delimited.txt, plus Markdown export- Formatting fidelity is strongest for
.xlsxand.xlsm; legacy workbook and delimited inputs are value-first previews with limited style metadata
MCP Viewer (When Available)
If the spreadsheet-peek MCP server is enabled, use it for user-visible previews before terminal output:
open_workbook_viewer(path="/absolute/path/to/file.xlsx", sheet="P&L", maxRows=50, maxColumns=40)
Use preview_workbook when the host selects it for a natural "preview this spreadsheet" request or when you need structured data without explicitly opening the grid. MCP tools return a bounded preview, sheet metadata, and text summary. The viewer supports sheet tabs, sticky headers, search, range selection, and selected-range handoff.
Use terminal wolfxl peek when MCP is unavailable, the agent is shell-only, or you need a copy-pasteable transcript.
When to Invoke (Proactive Triggers)
Always preview when:
- Before data processing: preview inputs before running pipelines, ETL jobs, or scripts that read a spreadsheet.
- After fixture changes: preview generated or modified spreadsheet and delimited fixtures.
- When the user references a file: if they mention a spreadsheet, CSV, TSV, or table-like text path, show it before discussing it.
- When debugging parsing: preview the raw input so parser behavior is grounded in the visible file.
- When comparing before/after: show the input and transformed output with the same preview habit.
Skip preview when:
- The file has already been previewed in the current conversation
- The file is being read programmatically (e.g., openpyxl/pandas in Python) and the code output already shows the data
- The user explicitly says they don't need to see it
- The file is enormous (>10K rows) and the user didn't ask - mention it exists and offer to preview a slice
Preview Ladder
Use the smallest preview that answers the question:
- First human-readable look:
wolfxl peek <file> -n 15 - Large or unfamiliar workbook briefing:
wolfxl agent <file> --max-tokens 800 - Repeat previews or context-sensitive work:
wolfxl peek <file> --export text | sed -n '1,20p' - Sheet structure before cell values:
wolfxl map <file> --format text
Token Efficiency (IMPORTANT)
wolfxl peek's box-drawing output uses Unicode border characters that cost real tokens. Choose the right mode based on context:
| Mode | When to use | Token cost (5 data rows) |
|---|---|---|
Box-drawing (wolfxl peek file -n 5) |
User is looking, readability matters | ~573 tokens (~115/row) |
Text export (wolfxl peek file --export text | sed -n '1,6p') |
Context-sensitive, large files, repeated previews | ~148 tokens (~30/row) |
Default rule: Use box-drawing for the FIRST preview in a conversation (readability). Switch to --export text | sed -n '1,Np' for subsequent previews or when context is getting long.
Measured ratio: box-drawing is ~3.9x more expensive per row than text export on a 7-column financial workbook, ~3.6x on an 8-column tall ledger, and ~3.0x on a 29-column wide table. The overhead is mostly fixed (header/border lines), so the per-row cost improves with more rows - but text export is still cheaper at every size.
Delimited fixtures: CSV/TSV/TXT ledger previews cost ~524 box tokens and ~145 text tokens; quoted multiline CSV costs ~401 and ~116.
Note: --export text ignores the -n flag and dumps ALL rows. Always pipe through sed -n '1,Np' to limit what enters the conversation. Prefer sed over head with current wolfxl-cli releases because head can close the pipe early and make wolfxl print a broken-pipe warning.
Command Variants
wolfxl peek <file> -n 0 # full readable dump, use sparingly
wolfxl peek <file> --sheet "Balance Sheet" -n 15 # specific sheet
wolfxl peek <file> -n 15 -w 60 # wider cells for long text
wolfxl peek <file> --export text # clean text for diffing or piping
wolfxl peek <file> --export markdown | sed -n '1,20p' # Markdown table for context converters
wolfxl peek <file> --export csv # CSV export
wolfxl peek <file> --export json # JSON export
Delimited File Notes
wolfxl peek reads .csv, .tsv, and comma-delimited .txt files directly in wolfxl-cli >= 0.9.0:
wolfxl peek file.csv -n 15
wolfxl peek file.tsv -n 15
wolfxl peek file.txt -n 15
For raw inspection, custom delimiters, dimensions, or older installed wolfxl binaries:
head -15 file.csv # raw sniff
head -15 file.csv | column -s, -t # simple CSV only
mlr --icsv --opprint head -n 15 file.csv # CSV-aware
csvlook --max-rows 15 file.csv # CSV-aware
mlr --icsv --opprint count file.csv # row count
mlr --icsv --opprint put '$columns = NF' then head -n 1 file.csv
Which to use: default to wolfxl peek for conversation-visible previews. Use head only for a raw text sniff, column -s, -t only on simple CSVs, and mlr/csvkit for custom delimiters, encodings outside UTF-8, or CSV-aware dimensions.
Known caveat: wolfxl-cli 0.9.0 is UTF-8 only and does not strip BOMs or detect arbitrary delimiters. A UTF-8 BOM may show in the first header cell; non-comma .txt files need a CSV-aware tool or a temporary conversion.
If you must use Python (CSV too messy for shell tools), reach for csv.DictReader + tabulate, not pandas - pandas has a ~1s import cost and is overkill for a preview.
Legacy Workbook Notes
wolfxl-cli >= 0.9.0 reads .xls, .xlsb, and .ods directly:
wolfxl peek file.xls -n 15
wolfxl peek file.xlsb -n 15
wolfxl peek file.ods -n 15
These formats expose values reliably but not full Excel style metadata. If you need high-fidelity styling, convert a temporary copy to .xlsx first:
mkdir -p /tmp/spreadsheet-peek
soffice --headless --convert-to xlsx --outdir /tmp/spreadsheet-peek file.xls
wolfxl peek /tmp/spreadsheet-peek/file.xlsx -n 15
If LibreOffice is not installed, use the direct preview and say legacy style fidelity is limited. If an older wolfxl rejects these inputs, upgrade with cargo install wolfxl-cli --version 0.9.0 --force.
Multi-Sheet Workflow
When previewing a multi-sheet workbook:
- First run shows the first sheet and lists available sheets in the output header (
Available sheets:line) - If the workbook has multiple sheets, preview ALL relevant sheets (financial workbooks typically have 2-5 sheets that matter)
- For repeated sheet previews, use text export to save tokens
# First sheet (readable, box-drawing)
wolfxl peek file.xlsx -n 15
# Subsequent sheets (token-efficient)
wolfxl peek file.xlsx --sheet "Balance Sheet" --export text | sed -n '1,20p'
wolfxl peek file.xlsx --sheet "Cash Flow" --export text | sed -n '1,20p'
Python Fallback
If wolfxl is unavailable, use openpyxl + tabulate:
import openpyxl, tabulate
wb = openpyxl.load_workbook('file.xlsx', data_only=True)
ws = wb.active
rows = [[cell.value for cell in row] for row in ws.iter_rows()]
print(tabulate.tabulate(rows[1:], headers=rows[0] or [], tablefmt='grid'))
Why wolfxl peek Over Disposable Python Scripts
wolfxl peek saves the agent from generating throwaway Python every time a workbook appears. The tradeoff:
- Box-drawing output is ~3-4x larger than text export for equal preview slices (Unicode borders cost tokens on the context side)
--export text | sed -n '1,Np'is the most token-efficient repeat-preview mode (~148 tokens for 5 financial rows; tiny rawopenpyxltuple dumps can be similar in output tokens but require generated code and are harder to read)- Reliability:
wolfxl peekavoids import errors, env issues, and edge cases in ad-hoc parsing code - Speed: Rust binary parses instantly vs ~0.5-1s openpyxl startup
- Readable formatting: Date cells render as ISO dates, common currency/percentage formats render in human-facing previews, and numeric cells are grouped for scanning. Style fidelity is strongest for
.xlsx/.xlsm.
Never write disposable Python to view a spreadsheet. Use wolfxl peek.
Output Interpretation Notes
- Empty cells show as blank (no value in the cell)
- Numeric cells are grouped for readability (e.g.,
1,200instead of1200) - Date cells render as ISO
YYYY-MM-DD; common currency and percentage number formats render in human-facing.xlsx/.xlsmpreviews - The header line
Sheet: SheetName (N rows × M columns)tells you the full dimensions Available sheets:line appears when the workbook has multiple tabs- The banner
wolfxl peek - Excel previewconfirms you're gettingwolfxloutput (vs a manual openpyxl dump)