docs_search_replace
Locate text in a Google Doc and replace a targeted occurrence, preserving document history. Use exact match or regex, and choose which occurrence to update or replace all.
Instructions
Find text in a Google Doc and replace a specific occurrence.
Preserves document history — uses real batchUpdate, not delete-and-rewrite.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| find | Yes | Text to search for (or regex pattern if regex=True) | |
| regex | No | If True, treat `find` as a Python regular expression | |
| doc_id | Yes | Google Doc ID | |
| replace | Yes | Text to replace it with | |
| occurrence | No | Which occurrence to replace. 1 = first (default), 2 = second, 0 = replace ALL occurrences. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |