xlsx

Create, edit, and recalculate Excel spreadsheets using openpyxl, pandas, and LibreOffice.

Updated Sep 11, 2026
One-click install
npx skills add https://github.com/CYRUS-pinto/pi-bot --skill xlsx-cyrus-pinto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: xlsx
Source: https://github.com/CYRUS-pinto/pi-bot/tree/main/.agents/skills/xlsx
Command: npx skills add https://github.com/CYRUS-pinto/pi-bot --skill xlsx-cyrus-pinto

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Spreadsheet tasks often fail silently: formulas written by openpyxl have no cached values, unsupported functions become #NAME? errors, and external links get destroyed on save. This Skill provides a disciplined workflow for producing spreadsheet files that actually recalculate correctly and follow professional formatting conventions. ## Core Features & Use Cases - Spreadsheet creation and editing: Build or modify .xlsx, .xlsm, .xltx, .csv, and .tsv files with openpyxl and pandas, using real formulas instead of hardcoded values. - Mandatory formula recalculation: Run scripts/recalc.py to evaluate every formula through LibreOffice and receive a JSON report of errors by cell location. - Financial modeling conventions: Apply standard color coding, number formats, and assumption documentation for professional financial models. - Use Case: A user asks to add a revenue forecast tab to an existing workbook. The Skill writes SUMIFS and INDEX/MATCH formulas, recalculates the file in place, fixes any reported errors, and delivers a workbook whose values update when inputs change. ## Quick Start Use the xlsx skill to add a totals row with SUM formulas to my sales-report.xlsx and make sure every formula recalculates without 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)'. Because openpyxl stores no cached values, recalculate the file with LibreOffice afterward so pandas and previewers can read the computed results.

openpyxl vs pandas for Excel files: which should I use?

Use openpyxl when you need formulas, formatting, or cell-level edits; use pandas read_excel and to_excel for bulk data movement. For a quick look at sheet contents, markitdown renders each sheet without cell coordinates.

Why do openpyxl formulas show None when I read them back?

openpyxl writes formulas as strings with no cached values, so data_only=True returns None until the file is recalculated. Running LibreOffice headless recalculation computes every formula and rewrites the file in place.

Which Excel functions work with LibreOffice recalculation?

Excel-2007-era functions like SUMIFS, INDEX, MATCH, IFERROR, and SUMPRODUCT work directly. Six newer functions need an _xlfn. prefix (TEXTJOIN, CONCAT, IFS, SWITCH, MAXIFS, MINIFS), while XLOOKUP, XMATCH, SORT, FILTER, UNIQUE, and SEQUENCE must be avoided entirely.

Can openpyxl edit xlsm files without losing macros?

Yes, pass keep_vba=True to load_workbook so the VBA project is preserved on save. Without that flag, saving an .xlsm file strips its macros permanently.

Why do external workbook links break after editing with openpyxl?

openpyxl strips cached values from cells referencing other files, and LibreOffice then fails to resolve them, writing #NAME? and deleting the links. Copy those cells' values from the original before saving, since recalc.py refuses to run in that state without --force.