office-xlsx
Excel workbooks
Follow an explicit user or applicable AGENTS.md requirement for an environment or library. Otherwise call load_workspace_dependencies and run its Python executable with bundled openpyxl and pandas. Do not install packages or search for a system Python for the default workflow. If the tool is unavailable, use an already configured environment and report a missing dependency only when it prevents the requested operation.
Keep scripts, working files, and outputs in the task workspace. The runtime and skill directory are shared read-only resources. Save to a new workbook unless the user requests an in-place edit.
Read and modify
Use openpyxl for existing XLSX workbooks and targeted cell or style changes. Load with data_only=False when formulas must survive. Inspect sheet names, the affected cell types, formulas, styles, merged ranges, and referenced ranges before editing. Check the saved file by reopening it, including unchanged content that the request requires preserving.
Use pandas for data analysis and transformations. A DataFrame is not the workbook: exporting it over an existing file can lose sheets, formulas, charts, and formatting. Write analysis results back to the intended ranges with openpyxl. XlsxWriter can create new workbooks, but cannot read or modify existing ones.
For a new workbook, the selected Python environment can write editable values, styles, and formulas directly:
from openpyxl import Workbook
from openpyxl.styles import Font