Help Centre › Functions & Formulas
This article describes the RPA Google Workspace connector function to find and replace text in a Google Docs document.
For a full list of available functions, please read GOOGLE WORKSPACE functions.
Description
The Replace text function finds all occurrences of a text string in a Google Docs document and replaces them with a new value. Supports case-sensitive matching.
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Connector | Yes | Select | - | Select the Google Workspace connector to use |
| Document ID | Yes | Text | - | Google Docs document ID |
| Find | Yes | Text | - | The text to search for |
| Replace | Yes | Text | - | The replacement text |
| Match case | No | Boolean | false | Whether the search is case-sensitive |
| Variable | Yes | Text | - | Variable to store the result |
Output variables
| Variable | Type | Description |
|---|---|---|
| Variable | Object | Object containing occurrencesChanged count |
Errors
- Document not found – the document ID is invalid or you lack access
Tips
- Use placeholder tokens like {{name}} in document templates for easy replacement
- The function replaces all occurrences, not just the first
Related functions
- Get text – Get the document text to verify replacements
- Insert text – Insert text at a position