home / skills / leegonzales / aiskills / excel-auditor

excel-auditor skill

/ExcelAuditor/excel-auditor

This skill analyzes unknown Excel files to uncover purpose, audit formulas, detect errors, and document maintainability risks for informed decisions.

npx playbooks add skill leegonzales/aiskills --skill excel-auditor

Review the files below or copy the command above to add this skill to your agents.

Files (7)
SKILL.md
4.0 KB
---
name: excel-auditor
description: "Analyze unknown or inherited Excel files to understand what they do, document their purpose, audit formulas for errors, and assess maintainability risk. Use when: (1) User uploads an Excel file asking 'what does this do?', (2) User needs to understand an inherited/legacy spreadsheet, (3) User wants formula auditing or error detection, (4) User asks about spreadsheet risk, complexity, or documentation, (5) User mentions 'inherited', 'legacy', 'undocumented', or 'someone left' regarding Excel files."
---

# Excel Auditor

Analyze unknown Excel files to understand purpose, audit formulas, detect errors, and generate documentation.

## Core Workflow

### 1. Extract Structure
Run the structure extraction script on the uploaded file:

```bash
python scripts/extract_structure.py /mnt/user-data/uploads/<filename>.xlsx
```

This produces JSON with: sheets, named ranges, tables, external links, data validation rules, conditional formatting, and VBA presence.

### 2. Extract Formulas
Run formula extraction to build dependency graph:

```bash
python scripts/extract_formulas.py /mnt/user-data/uploads/<filename>.xlsx
```

This produces JSON with: all formulas, cell dependencies, calculation chains, and formula complexity metrics.

### 2b. Validate Extraction Output
Before proceeding, verify JSON output contains expected keys:
- Structure: `sheets`, `named_ranges`, `tables`, `external_links`, `data_validation`, `conditional_formatting`, `vba_present`
- Formulas: `formulas`, `dependencies`, `calculation_chain`, `complexity_metrics`

If keys are missing or malformed, note limitations in final report.

### 3. Semantic Analysis
With structure and formula data, perform semantic analysis:

**Purpose Detection**: Infer file purpose from:
- Sheet names and structure patterns
- Named range naming conventions
- Formula patterns (financial, statistical, lookup-heavy)
- Data shapes and header labels

**Pattern Recognition**: Match against known archetypes (see references/patterns.md):
- Financial models (DCF, budget, P&L)
- Operational trackers (inventory, scheduling, CRM)
- Reporting templates (dashboards, KPI rollups)
- Data transformation pipelines

### 4. Error Detection
Identify issues in order of severity:

| Category | Issues | Severity |
|----------|--------|----------|
| **Hard Errors** | #REF!, #DIV/0!, #VALUE!, #N/A, #NAME?, #NULL!, #NUM!; Circular references (unless intentional); Broken external links | Critical - file is broken |
| **Soft Errors** | Hardcoded values that should be inputs; Inconsistent formula patterns; Volatile function overuse (NOW, TODAY, RAND, INDIRECT, OFFSET); Missing IFERROR on lookups; Implicit intersection risks | Warning - file works but fragile |
| **Smells** | Magic numbers; Excessive nesting (>3 levels); Very long formulas (>200 chars); Mixed units without labels; Color-coded logic without legend; Hidden sheets with active dependencies | Info - maintainability concerns |

### 5. Generate Report
Produce structured output using the template in `references/report_template.md`.

## Output Formats

**Default**: Markdown report in chat
**On request**: Generate .md or .docx file with full report
**On request**: Annotated copy of Excel with comments on flagged cells

## Handling Edge Cases

**Very Large Files (>10MB)**:
- Sample analysis of first 1000 formulas
- Focus on structure and high-level patterns
- Note that full audit requires sampling

**Password Protected**:
- Cannot audit, inform user

**VBA Present**:
- Note VBA exists but cannot audit macro logic
- Flag as elevated risk for maintainability

**Binary .xls Format**:
- Attempt conversion or note limitations

## Error Response Templates

When no issues found:
> "This file appears well-structured with no formula errors detected. [summary of what it does]"

When issues found:
> "I found [N] issues requiring attention. The most critical: [top issue]. Full audit below."

When file is severely broken:
> "This file has significant structural issues that prevent complete analysis. [list blocking issues]"

Overview

This skill audits unknown or inherited Excel workbooks to explain what they do, document their structure, and surface formula errors and maintainability risks. It produces a prioritized findings report and can generate annotated copies or exportable documentation on request. Use it when you inherit undocumented spreadsheets or when you need a fast, structured audit of spreadsheet health.

How this skill works

The auditor extracts workbook structure (sheets, tables, named ranges, links, validations, conditional formatting, VBA presence) and pulls every formula to build dependency graphs and complexity metrics. It runs semantic analysis to infer purpose from sheet names, headers, named ranges, and formula patterns, matches the file to common archetypes, and classifies findings into hard errors, soft errors, and maintainability smells. The final output is a clear, prioritized report with remediation suggestions and optional annotated workbook or export formats.

When to use it

  • You upload an Excel file and ask “what does this do?”
  • You receive an inherited or legacy workbook with little or no documentation
  • You need formula auditing, error detection, or dependency mapping
  • You want an assessment of spreadsheet risk, complexity, or maintainability
  • You suspect hidden links, circular references, or undocumented macros

Best practices

  • Run structure and formula extraction first and validate JSON outputs before deeper analysis
  • Prioritize fixing hard errors (#REF!, #DIV/0!, circular references) before addressing soft issues
  • Document inputs and named ranges; convert hardcoded magic numbers to labeled inputs
  • Limit use of volatile functions and long nested formulas; replace with helper columns where appropriate
  • Treat files with VBA as higher risk; add source-controlled copies and consider migrating logic to well-tested scripts

Example use cases

  • Discover the purpose and key outputs of a three-year-old budget workbook left by a former employee
  • Audit a monthly reporting template to find fragile lookups and missing IFERROR guards
  • Generate a maintainability summary for a complex financial model before a handover
  • Detect broken external links and provide remediation steps for large imported data tables
  • Produce an annotated workbook highlighting cells with hard errors, volatile formulas, and hidden dependencies

FAQ

Can the tool analyze macros or VBA code?

It detects the presence of VBA and flags elevated risk but does not perform deep macro code analysis. Manual review or a dedicated VBA audit is recommended.

What happens with very large files?

For files >10MB the auditor samples formulas (default first 1,000) and focuses on structure and high-level patterns; full audits may require more time or selective sampling.

Can you return an editable report or annotated workbook?

Yes. The default is an in-chat Markdown report. On request you can receive a .md or .docx export and an annotated Excel copy with comments on flagged cells.