xlsx

Create, edit, and recalculate Excel spreadsheets with formulas using openpyxl and LibreOffice.

Updated Feb 20, 2026
One-click install
npx skills add https://github.com/gtbauke/bj-utils --skill xlsx-gtbauke
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: xlsx
Source: https://github.com/gtbauke/bj-utils/tree/main/.agent/skills/xlsx
Command: npx skills add https://github.com/gtbauke/bj-utils --skill xlsx-gtbauke

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires openpyxl, pandas, defusedxml, lxml, and includes scripts (resource) components.

What problem does it solve? Working with spreadsheet files programmatically often leads to broken formulas, hardcoded values that can't update, and Excel errors like #REF! or #DIV/0! that go unnoticed until delivery. This Skill provides a complete workflow for creating, editing, and analyzing .xlsx, .xlsm, .csv, and .tsv files while guaranteeing zero formula errors in the final deliverable. ## Core Features & Use Cases - Formula-First Spreadsheet Creation: Build dynamic Excel files with openpyxl where all calculations use native Excel formulas instead of hardcoded Python-computed values, keeping workbooks updateable. - Automated Formula Recalculation and Error Detection: Run the included recalc.py script to recalculate all formulas via LibreOffice and receive a JSON report pinpointing every #REF!, #DIV/0!, #VALUE!, or #N/A error by sheet and cell. - Financial Modeling Standards: Apply industry-standard color coding (blue inputs, black formulas, green cross-sheet links), number formatting rules, and assumption-cell conventions for professional financial models. - Use Case: A user asks to build a revenue projection model from messy CSV data. The Skill cleans the data with pandas, constructs the model with openpyxl using live formulas, recalculates with LibreOffice, and fixes any reported errors before delivery. ## Quick Start Use the xlsx skill to create a financial model spreadsheet from my sales data with formulas for totals and growth rates, then verify it has no formula errors.

Frequently Asked Questions about xlsx

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

FAQPage Schema
How do I create an Excel file with formulas in Python?▼

Use openpyxl to write formula strings directly into cells, such as sheet['B10'] = '=SUM(B2:B9)'. Always use Excel formulas instead of computing values in Python so the spreadsheet recalculates when source data changes.

How do I recalculate Excel formulas after editing with openpyxl?▼

openpyxl stores formulas as strings without computed values, so run the included recalc.py script with python scripts/recalc.py output.xlsx. It uses LibreOffice headless to recalculate all formulas and returns a JSON report of any errors found.

Should I use pandas or openpyxl for Excel files?▼

Use pandas for data analysis, bulk operations, and simple exports with pd.read_excel and df.to_excel. Use openpyxl when you need formulas, cell formatting, multiple sheets, or edits to existing workbooks while preserving structure.

Why does my Excel file show #REF! or #DIV/0! errors?▼

These errors come from invalid cell references or division by zero in formulas. The recalc.py script scans every cell and reports exact error locations by sheet and coordinate so you can fix references and add denominator checks.

Can openpyxl read calculated formula values from Excel?▼

Yes, load the workbook with data_only=True to read cached calculated values. Be careful: saving a workbook opened with data_only=True permanently replaces formulas with their values.

Does this work in sandboxed environments where LibreOffice fails?▼

Yes, the scripts/office/soffice.py helper detects blocked Unix sockets at runtime and applies an LD_PRELOAD shim so LibreOffice headless recalculation works in restricted sandboxed environments.