xlsx
Creates, edits, analyzes, or converts Excel spreadsheets (.xlsx, .xlsm, .xltx) where the workbook file is the primary deliverable. Use for formulas, formatting, financial models, multi-sheet workbooks, and tabular cleanup exported to Excel. Also applies to .csv/.tsv when the user wants spreadsheet o
- 0
- Installs
- —
- Rating
- —
- Success rate
- 14
- Files scanned
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 eeb9c9099b6b4184… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
XLSX creation, editing, and analysis
| Task | Approach |
|---|---|
| Create or edit with formulas/formatting | openpyxl — see gotchas below |
| Bulk data in or out | pandas (read_excel, to_excel) |
| Quick look at a sheet | markitdown file.xlsx — ## SheetName per sheet, no cell coordinates. Use openpyxl for .xlsm and precise edits |
| Read a model (formulas and values) | two load_workbook passes — see gotchas |
Do not assume packages are preinstalled. Reuse a suitable environment or use
uv run --with openpyxl==3.1.5 python your_script.py. Install optional tabular readers only when needed; MarkItDown requires itsxlsxextra. The bundled workflow was exercised with openpyxl 3.1.5 and LibreOffice 26.2.4.2; current online LibreOffice help describes 26.8.
Script paths below are relative to this skill's directory.
Requirements for every output
- Professional font (Arial, Times New Roman) throughout, unless the user says otherwise.
- Zero formula errors. Never ship while
recalc.pyreportserrors_found. If you think an error predates you, prove it: load the original withdata_only=Trueand look at that cell. An error you introduced looks exactly like one you inherited. - Use formulas, never hardcoded results. Write
sheet['B10'] = '=SUM(B2:B9)', not the Python-computed total. The sheet must recalculate when its inputs change. - Follow the user's spec literally. Exact tab names, exact column headers, and the formula they spelled out. A redesign that computes something else fails, however elegant.
- Document every assumption and hardcoded number where the reader will see it — a cell comment, or an adjacent cell at a table's end. Cite a real source when one exists (
Source: Company 10-K, FY2024, Page 45, Revenue Note, [SEC EDGAR URL]); when the number came from the user, say so plainly. - A workbook you create for someone to fill in needs a short legend naming which cells to edit, and one example row of realistic values showing the expected format. Never add such a row to a file you were asked to edit.
- Editing an existing file: match its conventions exactly. They override every guideline here. Find its designated input cells first — a distinct font color, fill, or shading marks them — preserve its formulas unless the user requests formula changes. Make requested changes on a working copy.
Recalculate and verify
openpyxl does not evaluate formulas. Saving through it removes worksheet formula caches;
load_workbook(data_only=True) then returns None for those formula cells until a spreadsheet
engine computes them. Input constants remain present. Setting fullCalcOnLoad alone does
not generate cached values.
python scripts/recalc.py output.xlsx 30 # optional timeout in seconds; default 30
python scripts/recalc.py --help
The helper runs LibreOffice calculateAll() on a staged copy with a temporary profile,
document macros disabled, and linked-document updates disabled. It checks that the file was
rewritten, original formula anchors remain, and formulas have caches (empty string results
are valid). On a successful check it replaces the original path atomically. Keep a backup:
LibreOffice can change formatting, embedded objects, formulas, and external links during export.
It is a calculation compatibility check, not native Excel certification or a network sandbox.
Read the JSON, not just the exit code:
status: success: no typed error cells found.total_formulascounts formula cells including array anchors, not every output cell of an array.status: errors_found: recalculation completed and the file was replaced, but it contains typed Excel errors. Both statuses exit 0.total_errorsanderror_summaryreport errors; each type lists at most 100 locations with an optionallocations_truncatedcount.- An
errorkey with nostatus: conversion or verification failed; the original was not replaced and the command exits 1. Invalid CLI arguments exit 2. Retain the original and investigate instead of treating this as a successful recalculation.
A clean error scan does not prove correct results or complete array output. Independently
check expected values, units, totals, formula ranges, and every intended array output cell.
Compare relevant styling, charts, links, and macros before/after; open or render the workbook
in its intended application and inspect column widths, number formats, print areas, and charts.
office/validate.py explicitly performs no XLSX schema validation; its exit code is not an
XLSX validity certificate.
External links and protected features
='[1]Returns Analysis'!$B$2 references another file through the workbook's external-reference
list. keep_links=True (openpyxl's default) preserves external-link data where supported;
it does not preserve cached results of worksheet formulas when saving. An unavailable
source may turn a previously cached result into an error after recalculation.
The helper refuses direct, named, and array references it recognizes when their worksheet
caches are absent. This is a partial guard: transitive names, charts, conditional formatting,
and other links may escape detection. --force bypasses it and accepts possible loss; use
only on a disposable copy. It does not supply missing source files or refresh linked data.
For important external links, VBA/UDFs, dynamic spills, controls, or other Excel-only features,
use a compatible Excel workflow and verify the actual target engine. If static values are
requested, extract them from the original cached-value load and label that conversion clearly.
Choosing formulas that survive verification
Use English function names and commas in formulas written by openpyxl, even if Calc's UI
uses semicolons. OOXML functions added after the original specification may require _xlfn.;
some additionally use _xlws.. A prefix is not a guarantee of engine support.
SUMIFS,INDEX,MATCH,IFERROR, andSUMPRODUCTremain useful portable choices.- Prefix newer functions as required, for example
=_xlfn.TEXTJOIN(",",TRUE,A1:A3). Verify the exact formula in the deployed engine; do not infer support from its spelling. - Scalar XLOOKUP and XMATCH work in current LibreOffice. Both were added in 24.8;
_xlfn.XLOOKUP(2,A1:A3,B1:B3)and_xlfn.XMATCH(2,A1:A3)were exercised in 26.2.4.2. XMATCH returns a position; it is not a spilling array function. SORT,FILTER,UNIQUE, andSEQUENCEalso exist since LibreOffice 24.8, but array storage matters. A bare=_xlfn.SEQUENCE(3,1,1,1)produced only its first value in the tested round trip with no error. Do not equate an error-free cell with a complete spill.- For a fixed output range, openpyxl supports
ArrayFormula; assign it to the range's top-left cell and verify every output. This does not promise an automatically resizing Excel dynamic spill. Use native Excel when resizing/spill semantics are required.
from openpyxl import Workbook
from openpyxl.worksheet.formula import ArrayFormula
wb = Workbook()
ws = wb.active
ws["A1"] = ArrayFormula("A1:A3", "=_xlfn.SEQUENCE(3,1,1,1)")
wb.save("sequence.xlsx")
wb.close()
# Run recalc.py sequence.xlsx, then verify A1:A3 == [1, 2, 3].
openpyxl gotchas
- Reading a model takes two loads.
data_only=Trueyields cached values with the formulas gone; the default yields formula strings with no values. One pass cannot give you both. data_only=Trueis destructive if you save. That workbook has no formulas left, so saving replaces every one with a literal — permanently.data_only=Trueon a file openpyxl just wrote returnsNonefor formula cells — runrecalc.pyfirst. (A formula whose result is""also reads back asNone.)- Merged cells: write the top-left anchor only. Every other cell in the range is a
MergedCellwhose.valueis read-only. .xlsmloses its macros unless you passkeep_vba=Truetoload_workbook. This preserves VBA data, not every Excel feature. Before editing a feature-rich workbook, inventory shapes, controls, drawings, and other embedded objects; openpyxl does not preserve all of them. Save a working copy and compare those objects after saving and recalculation. If required objects cannot survive the round trip, use a compatible Excel workflow instead of delivering a stripped workbook.- Quote sheet names in cross-sheet references:
='Assumptions Inputs'!$B$5. Useopenpyxl.utils.cell.quote_sheetname(name)to also escape apostrophes. - Rich text needs
rich_text=Trueon load if its cell-level formatting must survive. - Templates require
wb.template=Trueand a matching.xltx/.xltmextension; renaming an ordinary workbook is insufficient. The helper loads templates for editing withAsTemplate=False. - Untrusted text beginning with
=must stay text: assign it, then set the cell'sdata_type = "s". Keep identifiers with leading zeros as strings, and explicit units/dates separate from measurements.
Financial models
Unless the user says otherwise, or the existing file already does something else.
Color: blue text (0,0,255) for hardcoded inputs and scenario levers · black for formulas ·
green (0,128,0) for links to another sheet · red (255,0,0) for links to another file ·
yellow fill (255,255,0) for key assumptions and cells the user should fill in.
Numbers: currency $#,##0, with the unit named in the header (Revenue ($mm)) · zeros
render as - ($#,##0;($#,##0);"-") · negatives in parentheses ·
percentages 0.0%;(0.0%);"-", stored as fractions (0.15 renders 15.0%; storing 15 renders
1500.0%) · valuation multiples 0.0"x" · years as text ("2024", never 2,024).
Structure: every assumption in its own labeled cell, referenced by the formulas that use it
(=B5*(1+$B$6), never =B5*1.05) · formulas consistent across every projection period, since a
lone edited cell mid-row is the commonest silent error · guard denominators that can be zero.
Worked verification example
This small synthetic example was recalculated with LibreOffice 26.2.4.2. The concentrations
are illustrative, not experimental measurements. Preserve the formula workbook after recalc;
do not save the data_only=True verification load.
from openpyxl import Workbook, load_workbook
from openpyxl.comments import Comment
from openpyxl.styles import Font
wb = Workbook()
ws = wb.active
ws.title = "Dilution"
ws.append(["Sample", "Stock (mM)", "Stock volume (uL)", "Final volume (uL)", "Final (mM)"])
ws.append(["Example A", 10, 20, 100, "=B2*C2/D2"])
ws["A4"] = "Edit A2:D2; E2 calculates concentration. Synthetic example inputs."
ws["B2"].comment = Comment("Illustrative stock concentration; replace with measured input.", "Source")
for row in ws.iter_rows():
for cell in row:
cell.font = Font(name="Arial", size=11)
for cell in ws[1]:
cell.font = Font(name="Arial", size=11, bold=True)
for col in "ABCDE":
ws.column_dimensions[col].width = 22
ws["E2"].number_format = '0.00'
ws.freeze_panes = "A2"
wb.save("dilution.xlsx")
wb.close()
# Run: python scripts/recalc.py dilution.xlsx
# Then in a separate verification step:
# cached = load_workbook("dilution.xlsx", data_only=True)
# assert cached["Dilution"]["E2"].value == 2
# cached.close()
For a new table-only export, pandas supports
df.to_excel("table.xlsx", sheet_name="Data", index=False, engine="openpyxl").
pd.read_excel(path, sheet_name=None, engine="openpyxl") reads all sheets into a dictionary;
choose dtype/converters and missing-value handling deliberately. A DataFrame round trip
is not a preservation workflow for styled models, formulas, or embedded objects.
Dependencies and reviewed documentation
Recalculation needs openpyxl and a separately installed LibreOffice (soffice on PATH).
The shared OOXML utilities also use defusedxml and lxml. Optional pandas handles tabular data;
MarkItDown needs markitdown[xlsx] for XLSX conversion. Do not assume .xlsm support from
MarkItDown's XLSX converter: its documented source dispatch recognizes .xlsx/XLSX MIME.
No API credentials or remote service calls are required for workbook processing.
- openpyxl loading, preservation, and templates
- openpyxl formulas and ArrayFormula
- pandas read_excel and to_excel
- MarkItDown XLSX converter
- LibreOffice XLOOKUP, XMATCH, and SEQUENCE
- LibreOffice document loading properties and calculateAll
This skill originates from Anthropic. Adapted here with repository metadata and additional preservation guidance; see LICENSE.txt for terms.
Files
14- LICENSE.txt
79f6d8f5b41.4 KB - SKILL.md
66eccd952a14.3 KB - scripts/office/helpers/__init__.py
678e42456d3.3 KB - scripts/office/helpers/pptx_chart.py
47ac266f7d5.7 KB - scripts/office/helpers/pptx_slide.py
7b9f69b4a51.6 KB - scripts/office/helpers/pptx_theme.py
ebb54c56e93.4 KB - scripts/office/soffice.py
85ca09ee0d7.8 KB - scripts/office/validate.py
346a4c89d96.0 KB - scripts/office/validators/__init__.py
83e0f035c5336 B - scripts/office/validators/base.py
72bdf2167d33.3 KB - scripts/office/validators/docx.py
2939667f6516.6 KB - scripts/office/validators/pptx.py
17eadad2b715.6 KB - scripts/office/validators/redlining.py
ed50d0885e11.0 KB - scripts/recalc.py
30eca7b8e912.9 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from K-Dense-AI/scientific-agent-skills8
Estimates intracellular metabolic fluxes from steady-state carbon-13 isotope-tracing measurements using validated atom maps, mfapy isotope simulation, constrained multistart fitting, and flux-profile diagnostics. Use for 13C-MFA, carbon tracing, mass isotopomer distributions (MDVs/MIDs), positional
Uses the Adaptyv Bio Foundry API and Python SDK to design protein characterization experiments, estimate costs, submit sequences, monitor laboratory progress, and retrieve results. Applies to Adaptyv Foundry, its target catalog, binding screening and affinity assays, thermostability, expression, flu
This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorit
Looks up precomputed AlphaGenome Atlas effects for any GRCh38 single-nucleotide variant (AVI score with Phred and 18 SHAP feature attributions, plus raw and quantile scores for RNA-seq, DNase, ATAC, ChIP-TF, ChIP-histone, CAGE, PRO-cap, splicing, polyadenylation and contact-map tracks), scores varia
Plans, executes, and documents validation, verification, and transfer of analytical procedures under the governing framework - ICH Q2(R2) and Q14, USP <1220>/<1225>/<1226>, ICH M10 bioanalytical, CLSI EP, or ISO/IEC 17025. Use for HPLC, LC-MS/MS, GC, CE, ICP-MS, dissolution, qNMR, qPCR, NIR, and lig
Handles annotated matrices in single-cell analysis, .h5ad and Zarr files, and integration with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.
Applies Arbor Hypothesis Tree Refinement to research artifacts with repeatable evaluators, including model training, agent harnesses, data synthesis and benchmark optimization. Uses persistent hypotheses, isolated experiments, evidence propagation and held-out candidate comparison for multi-experime
Infers candidate gene regulatory networks from bulk or single-cell expression data using AertsLab Arboreto GRNBoost2 and GENIE3. Use for transcription factor-target association ranking, compatible Dask execution, sparse expression inputs, and network stability checks.
Related mobile skillsscan passed
Production-ready Dart and Flutter patterns covering null safety, immutable state with Freezed, async composition, widget architecture, state management (BLoC, Riverpod, Provider), GoRouter navigation with auth guards, Dio networking, error handling, and testing. Use when writing or reviewing Dart an
Visual design audit for iOS apps on real hardware. (gstack)
Test iOS apps in a simulator with XcodeBuildMCP. Use when iOS changes need simulator evidence before handoff.
PostHog error tracking for Android
Manages Firebase Remote Config templates, feature flags, loading strategies, and SDKs (Android, iOS). Use when downloading/deploying remoteconfig JSON templates, managing version history/feature flags, setting in-app defaults, fetchAndActivate(), real-time listeners, or SDK setup. Don't use for Fire
AWS SDK for Swift development patterns. Use when writing Swift code that uses AWS services via aws-sdk-swift package.