formula_write
Write Excel formulas by setting, batch-setting, filling, or auto-summing cells. Handles single formulas, multiple formulas at once, filling a range, or summing a source range.
Instructions
Set, batch-set, fill or auto-sum formulas in cells.
Args:
action: "set", "batch", "fill", or "auto_sum".
- "set": requires cell_ref and formula (is_array optional, target_range optional).
- "batch": requires formulas dict mapping cell_ref to formula string, e.g. {"A1": "=SUM(B1:B10)", "A2": "=AVERAGE(C1:C10)"}.
- "fill": requires cell_ref (source) and target_range.
- "auto_sum": requires cell_ref (destination) and optional source_range.
file_path, sheet_name: Workbook and sheet to modify.
is_array: Whether the formula is an array formula.
target_range, formulas, source_range: Operation-specific params.
Returns: str | dict: Success message or batch result.
Notes:
- Writing formulas mutates the workbook. fill uses formula translation utilities; verify absolute/relative reference behaviour.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | ||
| formula | No | ||
| cell_ref | No | ||
| formulas | No | ||
| is_array | No | ||
| file_path | Yes | ||
| sheet_name | Yes | ||
| source_range | No | ||
| target_range | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |