Overview
The TextManipulation node is designed to perform advanced string manipulations on input data within n8n workflows. It allows users to extract text from various sources (plain text, files, or JSON fields), apply a customizable sequence of manipulations (such as case conversion, concatenation, encoding/decoding, substring extraction, replacement, trimming, padding, and repeating), and then output the manipulated result either as JSON or as a binary file.
Common scenarios:
- Cleaning and formatting text data before sending it to another system.
- Extracting and transforming content from uploaded files or JSON payloads.
- Preparing text for further processing, such as converting to specific encodings or removing unwanted characters/tags.
Practical examples:
- Reading a text file, stripping HTML tags, converting all text to uppercase, and saving the result as a new file.
- Extracting a field from incoming JSON, replacing certain substrings, and storing the cleaned value in a new JSON key.
- Concatenating a prefix and suffix to user-provided text, then encoding it in base64.
Properties
| Name | Type | Meaning |
|---|---|---|
| Keep Only Set Today! | boolean | If enabled, only values set by this node are kept; all other properties from the input are removed. |
| Texts with Manipulations | fixedCollection | Defines one or more sets of text manipulations to apply. Each set can specify data sources and a sequence of manipulations. |
| └ Data Sources | fixedCollection | Specifies where to read the text from: direct text, file, or JSON key. |
| └ Read Operation | options | How to read the source text: "Text" (direct input), "Read From File", or "Read From JSON". |
| └ Binary Property | string | (For files) The name of the binary property containing the file data. |
| └ Decode With | options | (For files) The character encoding to use when reading the file. |
| └ Strip BOM | boolean | (For files) Whether to remove the Byte Order Mark (BOM) if present. |
| └ Get Manipulated Data | boolean | (For files/JSON) Use the manipulated data instead of raw data, if available. |
| └ Source Key | string | (For JSON) The key (supports dot notation) to extract the text from. |
| └ Skip Non-String | boolean | (For JSON) If true, non-string values are skipped; otherwise, they are converted to strings. |
| └ Text | string | (For direct input) The plain text to manipulate. |
| └ Write Operation | options | Where to write the manipulated result: "Write to File" or "Write to JSON". |
| └ Destination Binary Property | string | (For file output) The binary property to store the resulting file. |
| └ Encode With | options | (For file output) The encoding to use when writing the file. |
| └ Add BOM | boolean | (For file output) Whether to add a BOM to the output file. |
| └ File Name | string | (For file output) The name of the output file. |
| └ Mime Type | string | (For file output) The MIME type of the output file. |
| └ Destination Key | string | (For JSON output) The key (supports dot notation) to store the manipulated text in. |
| └ Manipulations | fixedCollection | A list of manipulations to apply to the text, in order. Each manipulation defines an action and its parameters. |
| └ Action | options | The type of manipulation: Concat, Decode/Encode, Decode/Encode Entities, Letter Case, Pad, Repeat, Replace, Substring, Trim. |
| └ [Other action-specific fields] | various | Parameters relevant to the selected action (e.g., case type, regex, substring, pad string, etc.). |
Note: The full list of manipulation parameters is extensive and context-dependent. See the property definition for details.
Output
json:
- Contains the manipulated data. If "Write to JSON" is selected, the manipulated text is stored at the specified destination key (supports nested keys via dot notation).
- If "Keep Only Set Today!" is enabled, only the newly set values are included; otherwise, original input data is preserved alongside new/modified fields.
binary (optional):
- If "Write to File" is selected, the manipulated text is encoded and attached as a binary property with the specified name, file name, and MIME type.
Example output (JSON):
{
"data": "MANIPULATED TEXT HERE"
}
Example output (Binary):
- The binary property (e.g.,
data) contains the manipulated file contents, with metadata for file name and MIME type.
Dependencies
External Libraries:
iconv-lite: For encoding/decoding text in various character sets.entities: For decoding/encoding HTML/XML entities.lodash: For string manipulation utilities.string-strip-html(dynamically imported): For removing HTML tags (when using the "tags" predefined rule in replace).
n8n Core/Workflow modules:
- Uses standard n8n helper methods for binary data handling.
No external API keys or environment variables required.
Troubleshooting
Common issues:
- Invalid property names or missing keys:
- If a specified binary property or JSON key does not exist in the input, the node will skip processing or throw an error.
- Encoding errors:
- Using an unsupported or incorrect encoding may result in unreadable output or errors.
- Incorrect manipulation parameters:
- Providing invalid options (e.g., negative lengths, unknown actions) will cause the node to throw descriptive errors.
- Dynamic import failures:
- If the
string-strip-htmlpackage is not available, the "tags" replace rule will fail.
- If the
Error messages and resolutions:
"fromFile, fromJSON or fromText are valid options":- Check that the "Read Operation" is set to a supported value.
"toFile or toJSON are valid options":- Ensure "Write Operation" is correctly configured.
"The Target Length has to be set to at least 0 or higher!","The Times has to be set to at least 0 or higher!","The Length has to be set to at least 0 or higher!":- Provide non-negative numbers for these parameters.
"tags or characterGroups are valid options":- When using "Predefined Rule" in replace, ensure you select a valid rule.
"upperCase, lowerCase, capitalize, camelCase, kebabCase or snakeCase are valid options":- Choose a valid case transformation option.