home / skills / 404kidwiz / claude-supercode-skills / xlsx-skill

xlsx-skill skill

/xlsx-skill

This skill automates Excel workflows using Node.js and Python to generate, modify, and extract data from spreadsheets.

npx playbooks add skill 404kidwiz/claude-supercode-skills --skill xlsx-skill

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

Files (1)
SKILL.md
3.2 KB
---
name: xlsx
description: Expert in automating Excel workflows using Node.js (ExcelJS, SheetJS) and Python (pandas, openpyxl).
---

# XLSX Skill

## Purpose
Provides expertise in creating, reading, modifying, and automating Excel spreadsheet workflows. Specializes in programmatic spreadsheet manipulation using ExcelJS, SheetJS, pandas, and openpyxl for data processing, reporting, and automation.

## When to Use
- Creating Excel reports programmatically
- Reading and parsing XLSX files
- Modifying existing spreadsheets while preserving formatting
- Automating repetitive Excel tasks
- Converting between CSV and XLSX formats
- Building Excel templates with formulas
- Extracting data from complex spreadsheets
- Generating formatted financial or data reports

## Quick Start
**Invoke this skill when:**
- Creating Excel reports programmatically
- Reading and parsing XLSX files
- Modifying existing spreadsheets while preserving formatting
- Automating repetitive Excel tasks
- Converting between CSV and XLSX formats

**Do NOT invoke when:**
- Creating Google Sheets → different API
- Building Excel add-ins → use appropriate .NET/JS skill
- Data analysis without Excel output → use data-analyst
- CSV-only operations → use csv-data-wrangler

## Decision Framework
```
Excel Task?
├── Node.js Environment → ExcelJS (full-featured) or SheetJS (parsing)
├── Python Environment → openpyxl (Excel) or pandas (data + Excel)
├── Heavy Data Processing → pandas with openpyxl engine
├── Complex Formatting → ExcelJS or openpyxl
├── Template-Based → Fill existing templates with data
└── Large Files → Streaming readers (ExcelJS streaming, pandas chunks)
```

## Core Workflows

### 1. Excel Report Generation (Node.js)
1. Initialize ExcelJS workbook
2. Create worksheets with appropriate names
3. Define columns with headers and widths
4. Add data rows from source
5. Apply styling (fonts, borders, fills)
6. Add formulas for calculations
7. Set print area and page setup
8. Write to file buffer or stream

### 2. Spreadsheet Data Extraction (Python)
1. Load workbook with openpyxl or pandas
2. Identify data ranges and headers
3. Handle merged cells and formatting
4. Extract data into structured format
5. Validate and clean extracted data
6. Handle multiple sheets if needed
7. Convert to desired output format

### 3. Template-Based Reporting
1. Create master template with formatting and formulas
2. Load template workbook
3. Identify data insertion points
4. Insert data while preserving formulas
5. Update any date/reference cells
6. Recalculate formulas if needed
7. Save as new file (preserve template)

## Best Practices
- Use streaming mode for large files to manage memory
- Preserve existing styles when modifying files
- Validate data types before writing to cells
- Handle merged cells explicitly
- Use named ranges for maintainability
- Test with actual Excel application, not just libraries

## Anti-Patterns
- **Loading huge files in memory** → Use streaming readers
- **Hardcoding cell references** → Use named ranges or dynamic lookup
- **Ignoring data types** → Explicitly set number, date, text types
- **Overwriting formulas** → Check cell types before writing
- **Missing error handling** → Handle corrupted/password-protected files

Overview

This skill automates Excel spreadsheet workflows using Node.js (ExcelJS, SheetJS) and Python (pandas, openpyxl). It focuses on programmatic creation, reading, modification, and template-based reporting to deliver repeatable, tested Excel outputs for reporting and data exchange. The skill supports streaming for large files and preserves formatting and formulas when required.

How this skill works

The skill chooses libraries based on environment and task: ExcelJS or SheetJS for Node.js, openpyxl or pandas for Python. Core flows include generating formatted reports, extracting structured data from complex workbooks, and populating templates while preserving styles and formulas. It applies streaming readers/writers for memory-constrained scenarios and validates data types before writing.

When to use it

  • Create programmatic Excel reports with custom styles, formulas, and page setup.
  • Read and parse XLSX files to extract structured data from multiple sheets.
  • Modify existing workbooks while preserving formatting and formulas.
  • Automate repetitive Excel tasks like template population and export.
  • Convert between CSV and XLSX or generate Excel outputs from data pipelines.

Best practices

  • Use streaming readers/writers for large files to avoid high memory use.
  • Preserve existing cell styles and formulas when modifying templates.
  • Validate and coerce data types (number, date, text) before writing cells.
  • Use named ranges and dynamic lookups instead of hardcoded cell references.
  • Handle merged cells and protected files explicitly and include error handling.

Example use cases

  • Generate monthly financial reports from a database and export styled XLSX for stakeholders.
  • Extract line-item data from supplier-provided workbooks and convert into normalized CSV for ETL.
  • Populate a master invoice template with customer data and save individualized files.
  • Stream-process very large spreadsheets to extract subsets without loading entire file.
  • Convert multi-sheet CSV exports to formatted XLSX with headers, widths, and formulas.

FAQ

Which library should I pick for heavy data processing?

Use pandas with openpyxl as the engine for heavy data manipulation; pandas offers efficient vectorized operations and chunked reads.

How do I preserve formulas and formatting when inserting data?

Load the template workbook, identify insertion points or named ranges, write only to data cells, and avoid overwriting formula cells; use libraries that retain styles (ExcelJS or openpyxl).