MCP Office Word

v0.7.0
io.github.dosev-ai/mcp-office-word Checked 35 minutes ago Published 5 months ago

50-tool Word MCP server.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_workbook_context

Return an Artifact Context Packet (ACP) for an Excel workbook. Progressive disclosure via the ``level`` parameter: - **index** — identity + summary only (fast; single stat + openpyxl open) - **focused** — + sheet_names, sheet_count, table_names - **deep** — + metadata_policy, named_ranges (names only), lineage_summary, and optional annotations Security guarantees: - Path must be within EXCEL_ALLOWLIST_ROOTS (allowlist is enforced). - ACPDetail never contains cell values (S-001). - Annotations are validated with validate_acp_annotations() before storage. Returns a…

ParameterTypeDescription
path *string
annotations
levelstring

bulk_copy_sheet

Copy *source_sheet* to multiple new sheets in a single call. new_names: list of new sheet names to create (no duplicates, max 31 chars each, no /\*?[] chars). insert_after: if provided, new sheets are placed immediately after this sheet. Note: openpyxl copy_worksheet does NOT copy charts, images, or print settings. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
new_names *array
path *string
source_sheet *string
confirmboolean
insert_after

set_row_heights

Set heights for multiple rows in a single call. Mode 1 (uniform): provide rows or row_range (e.g. '1:20') plus height. Mode 2 (per-row): provide row_specs list of {"row": int, "height": float}. Valid height: 0.0–409.0. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
path *string
sheet *string
confirmboolean
height
row_range
row_specs
rows

set_column_widths

Set widths for multiple columns in a single call. Provide exactly one of columns (list of letters) or col_range (e.g. 'A:E'). Provide exactly one of width (0-255) or autofit=True. autofit approximates width from cell content; max_width caps the result. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
path *string
sheet *string
autofitboolean
autofit_paddingnumber
col_range
columns
confirmboolean
max_widthnumber
width

bulk_add_comments

Add multiple cell comments in one call. Each dict: address, text, author (optional). Returns comments_added count.

ParameterTypeDescription
comments *array
path *string
sheet *string
confirmboolean
overwriteboolean

fill_formula_range

Fill start_address:end_address with formula, auto-relativizing references. Formula must start with '='. Returns filled_cells count. Requires EXCEL_ENABLE_WRITE=true and confirm=True.

ParameterTypeDescription
end_address *string
formula *string
path *string
sheet *string
start_address *string
confirmboolean

bulk_range_write

Write multiple non-contiguous cells in a single tool call. Writes a list of cell updates to the same sheet in one open/save cycle — more efficient than calling ``range_io`` or ``cell`` once per cell.

ParameterTypeDescription
path *stringAbsolute path to the workbook. Must be within EXCEL_ALLOWLIST_ROOTS.
sheet *stringSheet name.
writes *arrayEach item: ``{"address": "A1", "value": <scalar>}``. Strings starting with ``=``, ``+``, ``-``, or ``@`` are rejected (formula injection guard).
confirmbooleanMust be True to authorise the write. Requires ``EXCEL_ENABLE_WRITE=true``.

chart

Manage Excel charts: create, list, delete, or update. operation='list': returns {"charts": [...], "count": N} — no confirm needed. operation='create': chart_type and data_address required. confirm=True required. chart_type: bar, line, scatter, pie. data_address: e.g. 'A1:B5' (include headers). target_address: cell where chart is placed (default 'D1'). width_px / height_px: chart size in pixels (1–5000). operation='delete': chart_index (0-based) required. confirm=True required. operation='update': chart_index and data_address required. confirm=True required. Write operations requir…

ParameterTypeDescription
operation *string
path *string
sheet *string
anchor
chart_index
chart_type
confirmboolean
data_address
height_px
target_address
titlestring
width_px

export_as_pdf

Export a worksheet or entire workbook to PDF via Excel COM. scope='sheet' exports a single named worksheet (sheet param required). scope='workbook' exports all visible sheets in print order. The source workbook is opened read-only and is not modified.

ParameterTypeDescription
output_path *stringAbsolute path for the output PDF file. Must be within EXCEL_EXPORT_ROOTS and end in .pdf.
path *stringAbsolute path to the source .xlsx/.xlsm workbook. Must be within EXCEL_ALLOWLIST_ROOTS.
scope *string'sheet' to export one worksheet; 'workbook' to export all visible sheets.
confirmbooleanMust be True.
qualityinteger0 = standard quality (default), 1 = minimum quality.
sheetWorksheet name (required when scope='sheet'; must be omitted when scope='workbook').

export_range_as_csv

Export a cell range as CSV. live=False (default): reads cached values via openpyxl -- no COM, CI-safe. live=True: reads live-evaluated values via Excel COM (Windows only, requires EXCEL_ENABLE_COM=true). output_path + any mode: write CSV to file (needs EXCEL_CSV_EXPORT_ROOTS + EXCEL_ENABLE_WRITE=true + confirm=True).

ParameterTypeDescription
address *stringCell range in A1 notation, e.g. "A1:C10".
path *stringWorkbook path within EXCEL_ALLOWLIST_ROOTS.
sheet *stringWorksheet name.
confirmbooleanRequired (True) when output_path is provided.
delimiterstringCSV delimiter character. One of: , \t ; | (default: ,).
include_headersbooleanIf True (default), all rows are written to CSV. If False, the first row (header) is skipped.
livebooleanIf True, use Excel COM to read live calculated values.
output_pathIf provided, write CSV to this .csv file.

recalculate_workbook

Force recalculation of all formulas in a workbook using Excel COM. Opens the workbook in Excel, triggers recalculation, saves in-place, and closes. The source workbook is modified (formulas are evaluated and their cached values updated in the file).

ParameterTypeDescription
path *stringAbsolute path to the .xlsx or .xlsm workbook. Must be within EXCEL_ALLOWLIST_ROOTS.
confirmbooleanMust be True. Required because this operation saves the source workbook in-place (permanent mutation).
full_calcbooleanIf True, calls Application.CalculateFull() which rebuilds the entire dependency tree across all open workbooks. If False (default), calls wb.Calculate() which recalculates only di…

hydrate_template

Open a workbook template, write cell values, and save as a new file. Writes data to named ranges or cell addresses in the template workbook and saves the result to output_path. The template is not modified (SaveAs creates a new file at output_path). cell_writes format (list of dicts with 'ref' and 'value' keys):: [ {"ref": "A1", "value": "scalar"}, {"ref": "A1:C2", "value": [[1, 2, 3], [4, 5, 6]]}, {"ref": "named_range", "value": "ProjectX"}, {"ref": "Sheet2!B3", "value": 42.0}, ]

ParameterTypeDescription
template_path *stringAbsolute path to source .xlsx/.xlsm template.
cell_writesList of {ref, value} write instructions.
confirmbooleanMust be True.
output_pathstringAbsolute path for output .xlsx/.xlsm file.
recalculatebooleanIf True (default), calls Application.CalculateFull() before SaveAs.
sheetOptional default sheet for Range() lookups.

pivot_table

Create, read, or refresh Excel pivot tables via Excel COM. operation='create': Build a new pivot table from a local worksheet range. operation='read': Return structure and data of a named pivot table. operation='refresh': Refresh all pivot caches (xlDatabase sources only).

ParameterTypeDescription
operation *string'create', 'read', or 'refresh'.
path *stringAbsolute path to .xlsx/.xlsm workbook.
col_fieldsField names for the column axis (create only).
confirmbooleanMust be True for create and refresh operations.
dest_addressUpper-left cell for pivot e.g. 'F1' (create only).
dest_sheetExisting sheet for pivot output (create only).
pivot_namePivotTable name to read (read only).
row_fieldsField names for the row axis (create only).
sheetWorksheet name (read: required; refresh: optional filter).
source_addressSheet-qualified range e.g. 'Sheet1!A1:D100' (create only).
table_namestringPivotTable name (create only; default 'PivotTable1').
value_fieldsField names to aggregate (create only).

get_active_workbook_context

Return name, path, and sheet list for the workbook active in Excel. Requires EXCEL_ENABLE_COM=true. Returns only workbooks within EXCEL_ALLOWLIST_ROOTS; workbooks outside the allowlist are treated as unavailable (status: outside_allowlist).

get_all_open_workbooks

List all workbooks open in the running Excel instance. Requires EXCEL_ENABLE_COM=true. Filters to EXCEL_ALLOWLIST_ROOTS only; workbooks outside the allowlist are silently excluded (their paths and names are not exposed — not even as a count or redacted entry).

list_macros

List all VBA components in a workbook via the VBA project object model. Enumerates VBProject.VBComponents and returns component names and types. Only .xlsm files have a VBA project; passing an .xlsx path raises ValidationError immediately.

ParameterTypeDescription
path *stringAbsolute path to .xlsm workbook. Must be within EXCEL_ALLOWLIST_ROOTS.

run_macro

Execute a VBA macro in an .xlsm workbook via Excel COM.

ParameterTypeDescription
macro_name *stringVBA Sub or Function name. Valid formats: "MyMacro" or "Module1.MyMacro". Must match ^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)?$ .
path *stringAbsolute path to .xlsm workbook. Must be within EXCEL_ALLOWLIST_ROOTS.
argsOptional list of positional arguments to pass to the macro.
confirmbooleanMust be True (write gate).

apply_number_format

Apply a number format code (e.g. '#,##0.00', 'YYYY-MM-DD') to a cell or range. Does NOT auto-save. Call save() to persist changes to disk. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
address *string
format_code *string
path *string
sheet *string
confirmboolean

apply_style

Apply styling to one or more cell ranges. address: single range string (e.g. 'A1:B2') — preferred. ranges: list of range strings — still supported for backward compat. Provide address OR ranges, not both. font_color and bg_color must be 6 hex digits without '#', e.g. 'FF0000'. Requires EXCEL_ENABLE_WRITE=true and confirm=True.

ParameterTypeDescription
path *string
sheet *string
address
bg_color
bold
confirmboolean
font_color
font_size
italic
ranges

apply_alignment

Apply alignment to a cell or range. *horizontal*: left, center, right, fill, justify. *vertical*: top, center, bottom. Does NOT auto-save. Call save() to persist changes to disk. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
address *string
path *string
sheet *string
confirmboolean
horizontal
vertical
wrap_text

add_border

Apply a border to all sides of a cell or range. *border_style*: thin, medium, thick, dashed, dotted, double. *color*: 6 hex digits without '#', e.g. '000000'. Does NOT auto-save. Call save() to persist changes to disk. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
address *string
path *string
sheet *string
border_stylestring
colorstring
confirmboolean

apply_format_to_sheet_list

Apply formatting to the same address across multiple sheets. sheets=None applies to all non-underscore-prefixed sheets (_Lists etc skipped). Explicit sheet list overrides the skip guard. style keys: bold, italic, font_size, font_color, bg_color. alignment keys: horizontal, vertical, wrap_text. column_widths: {"A": 15, "B:D": 12} — sets column widths on every target sheet. row_heights: {"1": 25, "2:10": 18} — sets row heights on every target sheet. EXCEL_MAX_RANGE_CELLS is enforced per sheet. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
path *string
address
alignment
column_widths
confirmboolean
number_format
row_heights
sheets
style

copy_range_format

Copy formatting only (no values) from src to dst range. Cross-sheet. dst can be single cell (auto-expands). Copies: font, fill, number_format, alignment. Border only if copy_border=True. Does NOT copy: values, formulas, comments, hyperlinks. MergedCell slave cells in src are skipped silently. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
dst_address *string
dst_sheet *string
path *string
src_address *string
src_sheet *string
confirmboolean
copy_borderboolean

write_range_with_format

Write a 2-D array of values to a range and apply consistent formatting in one call.

ParameterTypeDescription
address *stringTop-left cell or full range address (e.g. "B2" or "B2:E10").
data *array2-D list (rows x columns) of values to write.
path *stringAbsolute path to the .xlsx workbook.
sheet *stringWorksheet name.
alignmentOptional alignment dict. Allowed keys: horizontal, vertical, wrap_text, shrink_to_fit, text_rotation, indent.
confirmbooleanMust be True to execute the write.
number_formatOptional Excel number format string (e.g. "#,##0.00").
styleOptional style dict. Allowed keys: bold, italic, underline, font_color, bg_color, font_size, font_name.

apply_conditional_format

Apply a conditional-formatting rule to a range.

ParameterTypeDescription
address *stringCell range to apply CF to (e.g. "A1:Z100").
condition *stringFor cell_is: "<operator> <value>" e.g. "greaterThan 100", "between 10 20". Operator choices: greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, equal, notEqual, between, notBetw…
format_spec *objectFormatting to apply when rule fires. Allowed keys: bold, italic, font_color, bg_color, number_format (number_format silently ignored).
path *stringAbsolute path to the .xlsx workbook.
rule_type *string"cell_is" (compare cell value) or "formula" (arbitrary formula).
sheet *stringWorksheet name.
confirmbooleanMust be True to execute the write.
formulaRequired when rule_type="formula". Must start with "=".

format

Unified format dispatcher — routes 8 format operations through a single tool. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``. operation vocabulary -------------------- "number_format" Apply a number-format code to a cell or range. Params: path, sheet, address, format_code, confirm. "style" Apply font/fill styling to one or more ranges. Params: path, sheet, address (or ranges), bold, italic, font_size, font_color, bg_color, confirm. "alignment" Apply horizontal/vertical/wrap_text alignment.…

ParameterTypeDescription
operation *string
path *string
address
alignment
bg_color
bold
border_stylestring
colorstring
column_widths
condition
confirmboolean
copy_borderboolean
data
dst_address
dst_sheet
font_color
font_size
format_code
format_spec
formula
horizontal
italic
number_format
ranges
row_heights
rule_type
sheet
sheets
src_address
src_sheet
style
vertical
wrap_text

get_used_range

Return the bounding box of used cells in *sheet* of the workbook at *path*.

ParameterTypeDescription
path *string
sheet *string

cell

Read or write a single cell value. operation='read': returns cell value, type, and formula (read-only). operation='write': writes value to the cell. Requires EXCEL_ENABLE_WRITE=true and confirm=True. value=None is not allowed for 'write' (use range_io with values=[[None]] to clear a cell).

ParameterTypeDescription
address *string
operation *string
path *string
sheet *string
confirmboolean
value

range_io

Read or write a rectangular range of cells. operation='read': returns {"data": [[{...},...], ...], "rows": int, "cols": int}. operation='write': writes values 2-D array starting from address cell. Requires EXCEL_ENABLE_WRITE=true and confirm=True for 'write'.

ParameterTypeDescription
address *string
operation *string
path *string
sheet *string
confirmboolean
values

read_sheet_all

Read the entire used range of *sheet* from the workbook at *path*. Returns all cell data, row count, and column count. Subject to EXCEL_MAX_RANGE_CELLS guard.

ParameterTypeDescription
path *string
sheet *string

get_cell_metadata

Return formatting and metadata for a single cell. Includes font, fill, number format, comment, and hyperlink information. *address* must be in A1 notation (e.g. "B3").

ParameterTypeDescription
address *string
path *string
sheet *string

consolidate_ranges

Read multiple ranges from workbooks and merge into one table. Each entry in ``ranges`` must have keys: ``path``, ``sheet``, ``range``, and optionally ``label``. Enforces EXCEL_ALLOWLIST_ROOTS via wb.read_range (BLOCKER-2 compliance -- no direct openpyxl.load_workbook calls here). Does NOT require EXCEL_ENABLE_WRITE. Does NOT require confirm.

ParameterTypeDescription
ranges *array
max_rowsinteger
source_label_keystring

sheet

Manage workbook sheets: list, add, rename, or delete. operation='list': returns {"sheets": [str, ...], "count": int} — no confirm needed. operation='add': adds a new sheet named sheet_name at optional position. operation='rename': renames sheet_name to new_name. operation='delete': deletes sheet named sheet_name. Write operations require EXCEL_ENABLE_WRITE=true and confirm=True.

ParameterTypeDescription
operation *string
path *string
confirmboolean
new_name
position
sheet_name

list_tables

List all Excel tables (ListObjects) in *sheet*, or across all sheets when *sheet* is omitted. Each entry contains sheet, name, display_name, ref, header_row, and totals_row. Omitting *sheet* enables workbook-wide table discovery.

ParameterTypeDescription
path *string
sheet

read_table

Read all rows from a named Excel table in *sheet*. Returns table metadata, headers, and all data rows.

ParameterTypeDescription
path *string
sheet *string
table_name *string

append_rows

Append *rows* after the last used row in *sheet*. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
path *string
rows *array
sheet *string
confirmboolean

find_replace

Find and replace string values across all cells in *sheet*. Set ``whole_cell=False`` for substring replacement. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
find_value *string
path *string
replace_value *string
sheet *string
confirmboolean
match_caseboolean
whole_cellboolean

import_csv_to_sheet

Import a CSV or TSV file into *sheet*. All rows including the header row are imported by default so column names are preserved. Set ``skip_header=True`` to discard the first row. Set ``overwrite=True`` to replace an existing sheet with the same name. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
csv_path *string
path *string
sheet *string
confirmboolean
overwriteboolean
skip_headerboolean

named_range

List, read, or write Excel named ranges (defined names). operation='list': returns {"named_ranges": [{name, refers_to, scope}, ...], "count": N}. operation='read': reads the data values at the named range. name is required. operation='write': creates or updates a named range. name, sheet, address, confirm all required. 'write' requires EXCEL_ENABLE_WRITE=true and confirm=True.

ParameterTypeDescription
operation *string
path *string
address
confirmboolean
name
sheet

create_workbook

Create a new .xlsx workbook at the specified path. sheets: worksheet names to create (default: ["Sheet1"]). overwrite: if False (default), raises ExcelMCPError if the file exists. confirm: must be True (write gate — prevents accidental creation). Returns: {"ok": true, "path": "...", "sheets": [...], "created": true}

ParameterTypeDescription
path *string
confirmboolean
overwriteboolean
sheets

save

Flush the in-memory workbook at *path* to disk. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``. Evicts the workbook from the cache after saving.

ParameterTypeDescription
path *string
confirmboolean

workbook_metadata

Read or write workbook-level metadata stored on a hidden worksheet. operation='read': returns whether metadata is present plus stored payload details. operation='write': stores payload on hidden sheet _MCP_META. Requires EXCEL_ENABLE_WRITE=true and confirm=True.

ParameterTypeDescription
operation *string
path *string
confirmboolean
payload

evaluate_formula

Return the formula string and value for *address*. When live=False (default): openpyxl returns the last-saved cached value. When live=True: opens workbook via Excel COM for live evaluation. Useful for volatile functions (TODAY, NOW, RAND, OFFSET). Requires EXCEL_ENABLE_COM=true when live=True.

ParameterTypeDescription
address *string
path *string
sheet *string
liveboolean

capabilities

Return metadata about this MCP phase and its available tools.

merge

Manage merged cell ranges in a worksheet. operation='list': returns {"sheet": str, "merged_ranges": [str, ...], "count": int}. operation='merge': merges the address range. Requires EXCEL_ENABLE_WRITE=true and confirm=True. operation='unmerge': unmerges the address range. Requires EXCEL_ENABLE_WRITE=true and confirm=True.

ParameterTypeDescription
operation *string
path *string
sheet *string
address
confirmboolean

freeze_panes

Freeze rows/columns at a cell; pass address=None to unfreeze. Requires confirm=True and EXCEL_ENABLE_WRITE.

ParameterTypeDescription
path *string
sheet *string
address
confirmboolean

auto_filter

Apply Excel AutoFilter to a range; pass address=None to clear. Requires confirm=True and EXCEL_ENABLE_WRITE.

ParameterTypeDescription
address *
path *string
sheet *string
confirmboolean

rows

Insert or delete rows in a worksheet. operation='insert': inserts `count` blank rows before `start_row`. operation='delete': deletes rows from `start_row` to `end_row` (inclusive; end_row defaults to start_row). Both require EXCEL_ENABLE_WRITE=true and confirm=True.

ParameterTypeDescription
operation *string
path *string
sheet *string
start_row *integer
confirmboolean
countinteger
end_row

cols

Insert or delete columns in a worksheet. operation='insert': inserts `count` blank columns before `start_col` (1-based). operation='delete': deletes columns from `start_col` to `end_col` (inclusive; end_col defaults to start_col). Both require EXCEL_ENABLE_WRITE=true and confirm=True.

ParameterTypeDescription
operation *string
path *string
sheet *string
start_col *integer
confirmboolean
countinteger
end_col

protect

Protect or unprotect a sheet or the entire workbook structure. scope='sheet': protects/unprotects the named sheet. password=None clears protection. scope='workbook': protects/unprotects workbook structure. password=None clears protection. Both require EXCEL_ENABLE_WRITE=true and confirm=True.

ParameterTypeDescription
path *string
scope *string
confirmboolean
lock_structureboolean
lock_windowsboolean
password
sheet

set_print_area

Set or clear the print area for a worksheet. Pass address=None to clear the print area. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
address *
path *string
sheet *string
confirmboolean

cell_comment

Get or delete a cell comment. operation='get': returns comment text and author (read-only, no confirm needed). operation='delete': removes the comment. Requires EXCEL_ENABLE_WRITE=true and confirm=True.

ParameterTypeDescription
address *string
operation *string
path *string
sheet *string
confirmboolean

sheet_properties

Get or set sheet display properties. operation='get': returns tab_color, state, show_gridlines, show_row_col_headers, zoom_scale. operation='set': updates one or more properties. Requires EXCEL_ENABLE_WRITE=true and confirm=True.

ParameterTypeDescription
operation *string
path *string
sheet *string
confirmboolean
show_gridlines
show_row_col_headers
state
tab_color
zoom_scale

data_validation

Get or add data validation rules in a worksheet. operation='get': returns all validation rules for the sheet. operation='add': adds validation rules from the validations list. Each item must have 'address' key. Requires EXCEL_ENABLE_WRITE=true and confirm=True for 'add'.

ParameterTypeDescription
operation *string
path *string
sheet *string
confirmboolean
validations

validate_formula_syntax

Check whether a formula string is syntactically valid for Excel without writing it.

ParameterTypeDescription
formulastring
pathstring

copy_range

Copy cells (values and formats) from src_address to dst_address within the same sheet. Requires EXCEL_ENABLE_WRITE=true and confirm=True.

ParameterTypeDescription
dst_address *string
path *string
sheet *string
src_address *string
confirmboolean

create_table

Create a native Excel table (ListObject) over the specified range in a worksheet. address: cell range for the table (e.g. 'A1:D20'). style: Excel table style name (default 'TableStyleMedium9'). Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
address *string
path *string
sheet *string
confirmboolean
stylestring
table_name

set_column_visibility

Hide or show one or more columns. columns: list of column letters, e.g. ['A', 'C', 'D']. hidden: True to hide, False to show. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
columns *array
hidden *boolean
path *string
sheet *string
confirmboolean

set_workbook_calc_mode

Set workbook calculation mode and/or fullCalcOnLoad flag. calc_mode: one of 'auto', 'manual', 'autoNoTable'. None = no change. full_calc_on_load: if True, Excel recalculates all formulas on next open. Requires ``EXCEL_ENABLE_WRITE=true`` and ``confirm=True``.

ParameterTypeDescription
path *string
calc_mode
confirmboolean
full_calc_on_load

review_workbook_render

Review an Excel workbook's render quality before/after PDF export. Runs structural checks (PRINT_AREA_UNSET, SHEET_EMPTY, FORMULA_STALE, PRINT_AREA_EXCEEDS_PAGE) on the specified sheets and returns findings. Read-only — does NOT modify the workbook.

ParameterTypeDescription
path *stringAbsolute path to the .xlsx workbook.
recalculatedbooleanSet True if recalculate_workbook() was called before export. Suppresses FORMULA_STALE finding.
sheet_namesSheet names to review. None → all non-chart sheets.

produce_export_evidence_bundle

Produce a structured evidence bundle aggregating PDF export + review findings. Call after review_workbook_render and export_as_pdf to close the render-check-iterate loop.

ParameterTypeDescription
export_results *arrayList of export result dicts from export_as_pdf calls. Must be a list — raises ToolError if not. Each entry must contain at least 'sha256' and 'exported_at'.
path *stringAbsolute path to the workbook.
review_results *arrayList of review result dicts from review_workbook_render. Must be a list — raises ToolError if not.
exports_dirOptional directory containing the exported PDF(s).

export_changed_sheets_only

Re-export only sheets whose content has changed since the last export run. Uses openpyxl cell-value hashing to detect mutations. Exports changed sheets via export_as_pdf. Returns hashes for ALL sheets so the caller can store them for the next iteration. Requires EXCEL_ENABLE_WRITE=true. If EXCEL_ENABLE_COM is not true, falls back to hash-only mode (no PDF export). confirm=True is always required.

ParameterTypeDescription
base_dir *stringDirectory where per-run export subdirectories are created.
path *stringAbsolute path to the .xlsx workbook.
previous_hashes *objectDict mapping sheet_name → sha256 hash string from the previous run. Pass {} for the first run (all sheets are treated as changed).
confirmbooleanMust be True to proceed (mutation guard).

snapshot_workbook

Copy a workbook to a timestamped snapshot file. Creates a point-in-time copy of the workbook without opening it in Excel or openpyxl (shutil.copy2 preserves metadata). The snapshot filename defaults to <original_stem>_<YYYYMMDD_HHMMSS><original_suffix>.

ParameterTypeDescription
path *stringAbsolute path to source .xlsx/.xlsm workbook. Must be within EXCEL_ALLOWLIST_ROOTS.
confirmbooleanMust be True (write gate).
dest_dirDirectory to write the snapshot into. Must be within EXCEL_ALLOWLIST_ROOTS. If None, uses source file's parent directory.
filenameOverride the auto-generated snapshot filename. If provided, must end in .xlsx or .xlsm. If None, auto-generates: <stem>_<YYYYMMDD_HHMMSS><suffix>.

diff_workbooks

Compare two workbooks cell-by-cell and return differences. Loads both workbooks with openpyxl (data_only=True) and compares the values of matching sheets. Only sheets present in BOTH workbooks are compared (unless sheets is specified).

ParameterTypeDescription
path_a *stringAbsolute path to first workbook (baseline). Must be within EXCEL_ALLOWLIST_ROOTS.
path_b *stringAbsolute path to second workbook (comparison). Must be within EXCEL_ALLOWLIST_ROOTS.
max_diffsintegerMaximum total differences to return (default 200). Truncates result set with truncated=True flag.
sheetsOptional list of sheet names to compare. If None, compares sheets present in both workbooks.