Excel (.xlsx) workbooks
Work in the workspace dir (where uploads land) by writing short Python run via
exec. Two libraries, both preinstalled — pick by task:
After exec completes, use the Generated artifacts URL from the tool result in
the final answer so the user can download the workbook.
- pandas — bulk tabular read/write/analysis. Use for "load this sheet, compute, dump a table". Drops all formatting and formulas.
- openpyxl — cells, formulas, styles, charts, merged cells, multi-sheet, number formats. Use whenever formatting, formulas, or fidelity matter.
THE critical gotcha: openpyxl writes formulas but never computes them
ws["B10"] = "=SUM(B2:B9)" stores the formula string. openpyxl has no formula
engine — the cached value stays empty (or stale, on an edited file). So:
- A workbook you create/edit with openpyxl opens fine in Excel/LibreOffice (they recompute on open), but its cached values are wrong until then.
- Anything reading cached values first —
data_only=True, another pandas/openpyxl pass, or a downstream tool — sees blanks/stale data.
Pick by what the deliverable needs:
- Static numbers (most common). If the user just needs c…