# File Preview

> Structured file parser that extracts and renders Excel, PPT, Word, and PDF data into clean Markdown.

File Preview is a free AI agent skill pack (several skills in one listing) on Agensi by 糟糕西瓜, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [糟糕西瓜](https://www.agensi.io/creators/awfulwatermelon)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0
- Last updated: 2026-11-28
- Security: scan passed (2026-11-28); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/file-preview
- Tags: llm-ops, python, data-extraction, office-automation, document-parsing

## About this skill

Stop guessing what is inside binary Office files. Most LLMs struggle to read `.xlsx` or `.pptx` files directly, often leading to hallucinations or errors when users upload complex spreadsheets and slide decks. This skill provides a structured bridge, using a Python-based parser to extract raw data and present it as clean, readable Markdown.

### What it does
- **Extracts structured data** from Excel, Word, PPT, PDF, CSV, and raw text files without external heavy dependencies.
- **Handles legacy formats** by including a custom OLE2 parser for `.xls` (BIFF8) files to retrieve cell values and formula caches.
- **Generates document outlines** from Word headers and PPT slide titles including speaker notes.
- **Auto-detects encoding** for text-based files, switching between UTF-8 and GBK to prevent character corruption.
- **Metadata extraction** for images including dimensions and format verification.

### How it works
1. **Locate the file** provided by the user via local path or attachment.
2. **Execute the preview script** using `python scripts/preview.py` with optional flags for row or line limits.
3. **Transform the JSON output** into human-readable Markdown tables, outlines, or summaries based on the file type.

### Frameworks & tools
Built with Python using standard libraries for binary parsing. It optionally supports `pypdf` or `pdfplumber` for enhanced PDF text extraction if available in the environment.

### Why this beats prompting it yourself
Generic prompts often fail on binary file structures or produce "hallucinated" data when the context window is messy. This skill ensures every row, slide, and paragraph is grounded in actual file bytes before the AI even attempts to answer.

### Use cases
- Auditing financial spreadsheets for specific line items.
- Summarizing multi-page PowerPoint decks without opening them.
- Extracting table data from Word documents into clean Markdown.
- Quick inspection of log files or source code with encoding detection.

### Known limitations
Does not support legacy binary `.doc` or `.ppt` formats. Requires `pypdf` for PDF text extraction. Image content description requires an LLM with native vision capabilities.

## Requires

- Python

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the File Preview skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill prevent AI hallucinations when reading Excel or PowerPoint files?

This skill solves the "hallucination" problem by pre-parsing binary files into Markdown. Instead of the AI guessing the contents of a spreadsheet or slide deck, it receives a structured text representation of the actual data, ensuring much higher accuracy.

### Which specific file formats are supported, and does it handle legacy Office documents?

The skill supports modern Office formats (.docx, .xlsx, .pptx), PDF, CSV, and text files. It also features a specialized OLE2 parser for legacy .xls (Excel 97-2003) files, though it does not support legacy binary .doc or .ppt files.

### Can I limit the amount of data extracted to avoid hitting LLM token limits?

Yes, the skill includes a `preview.py` script that allows you to set optional flags for row or line limits. This is particularly useful for managing context window usage when dealing with massive spreadsheets or long documents.

### What exactly is included in the purchase of this skill?

You receive the core Python parsing logic, the `preview.py` execution script, and documentation on how to map the JSON output into Markdown. It is a self-contained toolset ready for integration into your agent's workflow.

### How does the skill handle files with non-standard or foreign character encodings?

The skill features an auto-detection system that toggles between UTF-8 and GBK encodings. This ensures that text-based files and logs are read correctly without the "mojibake" or broken characters often seen in generic parsers.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
