xlsx

Read, create, and edit Excel spreadsheets with formulas, styles, charts, and multi-sheet workbooks.

57.2k|7.0k|Updated Dec 28, 2025
Ready to run
npx skills add https://github.com/HKUDS/DeepTutor --skill xlsx-hkuds
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: xlsx
Source: https://github.com/HKUDS/DeepTutor/tree/main/deeptutor/skills/builtin/xlsx
Command: npx skills add https://github.com/HKUDS/DeepTutor --skill xlsx-hkuds

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires openpyxl.

What problem does it solve? This Skill eliminates the friction of programmatically working with Excel files—whether extracting data from complex workbooks, building reports from scratch with formatting and formulas, or batch-updating spreadsheets. It handles the full lifecycle of .xlsx/.xlsm files without external dependencies. ## Core Features & Use Cases - Read & Extract Data: Parse sheet data, formulas, and cached values from existing workbooks. - Create & Format: Build workbooks from scratch with styled cells, number formats, merged cells, and charts. - Edit & Preserve: Modify existing sheets while maintaining styles, formulas, and multi-sheet structure. - Bulk Processing: Handle large datasets with write-only mode and process CSV/TSV tables. - Use Case: Import quarterly sales data from 12 regional CSV files, merge into a single workbook with pivot-table formulas and conditional formatting, add a summary sheet with charts, then distribute to stakeholders. ## Quick Start Use the xlsx skill to extract all data from the spreadsheet 'sales-report.xlsx' and create a new summary sheet with totals by region.

Frequently Asked Questions about xlsx

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract data from an Excel file in Python?▼

Use openpyxl with `load_workbook('file.xlsx', data_only=False)` to read formulas and cell values. Set `data_only=True` to read cached formula results. Iterate through sheets and rows with `wb.sheetnames` and `ws.iter_rows(values_only=True)` to collect data.

How do I create an Excel file with formulas and formatting?▼

Create a Workbook, append rows, set cell formulas as strings (e.g., `ws['B10'] = '=SUM(B2:B9)'`), apply Font and PatternFill styles, adjust column widths, and freeze panes. Save with `wb.save()` and validate by reopening to check structure integrity.

Why don't my formulas show calculated values in the workbook I create?▼

openpyxl stores formula text but cannot compute values itself—cached cells remain empty until Excel or LibreOffice opens the file and recalculates. For immediate correct values, compute the result in Python and write the number instead of the formula string.

Can I preserve formatting when editing an existing Excel file?▼

Yes. Load with `load_workbook('file.xlsx')`, modify only the cells you need, and save. openpyxl preserves all existing styles, charts, merged cells, and formulas. Avoid loading and saving through pandas, which rewrites the entire sheet and loses formatting.

How do I handle large Excel files without running out of memory?▼

Use read-only mode (`load_workbook(path, read_only=True)`) to stream rows cheaply. For writing large datasets, use write-only mode (`Workbook(write_only=True)`) and append rows without holding cell objects in memory.

Does openpyxl support adding charts to Excel files?▼

Yes. Create a BarChart, LineChart, PieChart, or ScatterChart, define data and category ranges, add to a worksheet with `ws.add_chart()`, then save. Charts use openpyxl's Reference object to link cell ranges dynamically.