Claude /xlsx Skill (2026)

The /xlsx skill in Claude Code provides structured guidance for working with Excel files, CSVs, and tabular data. This tutorial covers practical scenarios: creating formatted reports, processing batches of files, and generating charts. with working code examples you can adapt immediately.

How the /xlsx Skill Works

The /xlsx skill is a .md file stored in ~/.claude/skills/ that loads when you type /xlsx in Claude Code. It gives Claude specialized context for spreadsheet tasks: understanding file formats, common libraries, formula conventions, and data processing patterns.

To invoke it:

/xlsx
I have a folder of monthly sales CSVs. I need a Python script
that reads each one, calculates totals per region, and writes
a summary workbook with one sheet per month.

Claude loads the skill’s guidance and produces code appropriate to your task. The skill does not run code itself. it helps Claude give you better, more accurate code for your spreadsheet work.

Setting Up Your Environment

The /xlsx skill works best when you have Python with openpyxl and pandas available, or Node.js with the xlsx package depending on your preference. Install what you need before starting:

Python approach
pip install openpyxl pandas
Or with uv
uv pip install openpyxl pandas

Mention your environment when invoking the skill so Claude generates compatible code:

/xlsx
Using Python with openpyxl. I need to create a new workbook
with a header row, styled blue, and three data columns.

Creating Formatted Workbooks

Here is a working example of formatted workbook creation using openpyxl:

from openpyxl import Workbook
from openpyxl.styles import Font, PatternFill
def create_report(output_path, headers, rows):
 """Create a formatted Excel report."""
 wb = Workbook()
 ws = wb.active
 ws.title = "Report"
 # Write styled headers
 header_font = Font(bold=True, color="FFFFFF")
 header_fill = PatternFill(
 start_color="366092",
 end_color="366092",
 fill_type="solid"
 )
 for col_idx, header in enumerate(headers, start=1):
 cell = ws.cell(row=1, column=col_idx, value=header)
 cell.font = header_font
 cell.fill = header_fill
 # Write data rows
 for row_idx, row_data in enumerate(rows, start=2):
 for col_idx, value in enumerate(row_data, start=1):
 ws.cell(row=row_idx, column=col_idx, value=value)
 # Auto-fit column widths
 for col in ws.columns:
 max_length = max(len(str(cell.value or "")) for cell in col)
 ws.column_dimensions[col[0].column_letter].width = max_length + 4
 wb.save(output_path)
 return output_path

Use the /xlsx skill to ask for variations. adding freeze panes, applying number formats, or adding a totals row with SUM formulas.

Processing Existing Data

Reading and analyzing spreadsheet data with pandas:

import pandas as pd
def summarize_sales_file(file_path):
 """Read an Excel file and return summary statistics."""
 df = pd.read_excel(file_path, sheet_name="Sales")
 return {
 "total_revenue": df["Revenue"].sum(),
 "average_order": df["Revenue"].mean(),
 "order_count": len(df),
 "top_region": df.groupby("Region")["Revenue"].sum().idxmax()
 }

When the file has multiple sheets or mixed data types, describe the structure to Claude after invoking /xlsx. it will generate the appropriate read_excel parameters.

Batch Processing Multiple Files

Processing a directory of files is a common request the /xlsx skill handles well:

from pathlib import Path
import pandas as pd
from openpyxl import Workbook
def consolidate_monthly_reports(input_dir, output_path):
 """Merge all Excel files in a directory into one summary workbook."""
 input_path = Path(input_dir)
 wb = Workbook()
 wb.remove(wb.active) # Remove default sheet

 for excel_file in sorted(input_path.glob("*.xlsx")):
 df = pd.read_excel(excel_file)
 ws = wb.create_sheet(title=excel_file.stem[:31]) # Sheet names max 31 chars

 # Write headers
 ws.append(list(df.columns))
 # Write rows
 for _, row in df.iterrows():
 ws.append(list(row))
 wb.save(output_path)
 return output_path

Ask Claude for additions like summary sheets, cross-sheet formulas, or conditional formatting across the consolidated output.

Adding Charts

Chart generation is a common follow-on request once the data is written:

from openpyxl.chart import BarChart, Reference
def add_bar_chart(ws, data_range_rows, title="Summary"):
 """Add a bar chart to a worksheet."""
 chart = BarChart()
 chart.type = "col"
 chart.style = 10
 chart.title = title
 chart.y_axis.title = "Value"
 chart.x_axis.title = "Category"
 start_row, end_row = data_range_rows
 data_ref = Reference(ws, min_col=2, min_row=start_row, max_row=end_row)
 cats_ref = Reference(ws, min_col=1, min_row=start_row + 1, max_row=end_row)
 chart.add_data(data_ref, titles_from_data=True)
 chart.set_categories(cats_ref)
 chart.height = 12
 chart.width = 20
 ws.add_chart(chart, "E2")

When invoking /xlsx for chart work, describe the chart type, what the X and Y axes represent, and where the source data lives. Claude generates the Reference configuration accurately when given that detail.

Error Handling for Production Scripts

Spreadsheet automation scripts that run unattended need reliable error handling:

def safe_read_excel(file_path, sheet_name=0):
 """Read an Excel file with informative error messages."""
 try:
 return pd.read_excel(file_path, sheet_name=sheet_name)
 except FileNotFoundError:
 raise FileNotFoundError(f"File not found: {file_path}")
 except PermissionError:
 raise PermissionError(f"File is open in another program: {file_path}")
 except Exception as e:
 raise RuntimeError(f"Could not read {file_path}: {e}") from e

Use /tdd alongside /xlsx to write tests for your processing functions before deploying them to run on live data.

Performance for Large Files

For workbooks with tens of thousands of rows:

Disable automatic formula recalculation during writes
wb.calculation.calcMode = 'manual'
Write data in bulk using ws.append() rather than cell-by-cell
for row in data_rows:
 ws.append(row)
Re-enable recalculation on open
wb.calculation.calcMode = 'auto'
wb.calculation.fullCalcOnLoad = True

This reduces processing time significantly for large datasets. Ask Claude via /xlsx for write-optimized variants when working with files over 10,000 rows.

Data Cleaning and Transformation

Messy imports with inconsistent formats are a common challenge. Build transformation pipelines that standardize data before analysis:

import pandas as pd
def clean_spreadsheet_data(input_file, output_file):
 """Standardize messy spreadsheet imports."""
 df = pd.read_csv(input_file)
 # Standardize date formats
 df['date'] = pd.to_datetime(df['date'], errors='coerce')
 # Remove duplicates
 df = df.drop_duplicates()
 # Handle missing amounts
 df['amount'] = df['amount'].fillna(0)
 # Clean category names (strip whitespace)
 df['category'] = df['category'].str.strip()
 # Remove rows with invalid dates
 df = df.dropna(subset=['date'])
 df.to_csv(output_file, index=False)

Common Pitfalls and Solutions

Memory issues with large files: Load only the columns you need:

df = pd.read_csv('huge_file.csv', usecols=['date', 'amount', 'category'])

Formula preservation: When updating values in a template with formulas, preserve calculations:

wb = load_workbook('template.xlsx', data_only=False)

Unicode and encoding: Always specify encoding for CSV files with special characters:

df = pd.read_csv('data.csv', encoding='utf-8-sig')

Combining with Other Skills

The /xlsx skill pairs naturally with others:

  • /pdf. extract invoice data from PDFs, then write it to a summary spreadsheet
  • /docx. pull tables from Word documents into Excel for further analysis
  • /tdd. write tests for your data transformation functions
  • /supermemory. save column mapping configurations between sessions

Try it: Estimate your monthly spend with our Cost Calculator.

This site was built by 5 autonomous agents running in tmux while I was in Bali. 2,500 articles. Zero manual work. 100% quality gate pass rate. The orchestration configs, sprint templates, and quality gates that made that possible are in the Zovo Lifetime bundle. Along with 16 CLAUDE.md templates and 80 tested prompts. **[See how the pipeline works →](https://zovo.one/lifetime?utm_source=ccg&utm_medium=cta-skills&utm_campaign=claude-xlsx-skill-spreadsheet-automation-tutorial)** $99 once. I'm a solo dev in Da Nang. This is how I scale.

Related Reading

Built by theluckystrike. More at zovo.one

Find the right skill → Browse 155+ skills in our Skill Finder.