find_replace
Replace text in Excel worksheets by specifying find and replacement strings, with support for regex, case matching, whole-cell matches, and formula search.
Instructions
Find and replace text across a worksheet.
Args: file_path: Path to workbook to modify. sheet_name: Worksheet name. find_text: Substring or pattern to find. replace_text: Replacement text. match_case: Case-sensitive search when True. match_entire_cell: Match entire cell contents exactly when True. search_formulas: Also search within formulas when True. regex: Treat find_text as a regular expression when True.
Returns: dict: {"count": int, "cells": ["A1", ...]} detailing replacements.
Notes: - Destructive: modifies cells in-place. - Consider returning per-cell before/after pairs for audit logging in high-risk contexts.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| regex | No | ||
| file_path | Yes | ||
| find_text | Yes | ||
| match_case | No | ||
| sheet_name | Yes | ||
| replace_text | Yes | ||
| search_formulas | No | ||
| match_entire_cell | No |