Replace Text
Replaces text in a Google Docs document.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Document Id - The ID of the Google Docs document to replace text in.
- Text to Replace - The text to search for and replace.
- Replacement - The replacement text.
Options
- Search case-sensitive - Whether the search should be case-sensitive. Default is false.
- Replacement Type - The type of replacement to perform. Options are:
- Text - Replace with plain text
- Link - Replace with a hyperlink
How It Works
The Replace Text node integrates with Google Docs to find and replace text within a document. When executed, the node:
- Validates the provided inputs (Document Id, Text to Replace, Replacement)
- Connects to the specified Google Docs document
- Searches for all occurrences of the specified text
- Replaces the found text with the replacement text or link
- Updates the document with the replaced content
Requirements
- A valid Google Docs document ID
- Valid Google Docs credentials
- Valid text to search for and replace
- Valid Google Docs permissions to modify the document
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid Document Id
- Empty or invalid Text to Replace
- Empty or invalid Replacement
- Google Docs service errors
- Insufficient permissions to modify the document
- No matching text found for replacement
Usage Notes
- The Document Id can be found in the URL of the Google Docs document
- When using the Link replacement type, the replacement text will be used as the URL for the hyperlink
- The Search case-sensitive option determines whether the search is case-sensitive
- All occurrences of the Text to Replace will be replaced with the Replacement text
- If no matches are found, an error will be returned
- The node supports both plain text replacement and hyperlink replacement