goal_seek
Determine the input value that makes a formula reach a specified target, then write the solved value back to the workbook.
Instructions
Find a variable cell value that makes an expression evaluate to a target and write the result.
Args: file_path: Workbook path. sheet_name: Worksheet containing the expression. variable_cell: Cell reference to adjust (e.g. "B2"). expression: Arithmetic expression referencing worksheet cells (string). target_value: Numeric target value for the expression. initial_value: Starting guess for the solver. tolerance: Convergence tolerance. max_iterations: Maximum solver iterations.
Returns: dict: Result with solved value, status, and iterations used.
Notes: - Destructive: writes the solved value back to the workbook. - Recommend adding a short example expression in docs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| tolerance | No | ||
| expression | Yes | ||
| sheet_name | Yes | ||
| target_value | Yes | ||
| initial_value | No | ||
| variable_cell | Yes | ||
| max_iterations | No |