Skip to main content

Find and Replace Text in Excel using n8n action

PDF4me Replace Text in Excel enables comprehensive search and replace operations in Excel documents through n8n automation workflows with optional formatting application. Process Excel files via n8n triggers, binary data, base64 strings, or public URLs to replace text using literal text matching or regular expressions (regex), with case-sensitive matching options, entire cell or partial matching, multiple replacement phrases in single operation, and optional formatting changes (font, color, size, bold, italic, underline, strikethrough, subscript, superscript). This solution is ideal for data standardization, content updates, error correction, automated text transformation, and privacy masking workflows that require text replacement across all worksheets with comprehensive formatting control and seamless integration.

Setup

Add the PDF4me "Replace Text" node to your n8n workflow and configure the required parameters. For initial setup instructions, see our n8n Integration Guide.

Prerequisites:

  • PDF4me API credentials
  • n8n workflow access

Configuration:

  1. Add PDF4me node to workflow
  2. Select "Find and replace text" action
  3. Configure input parameters (see below)
Replace Text in Excel

Parameters

Complete list of parameters for the Replace Text action. Configure these parameters to control text replacement.

Important: Parameters marked with an asterisk (***) are required. This action processes all worksheets in the Excel file.

ParameterTypeDescriptionExample
Input Data Type***StringExcel Input Format Selection
• Choose the format of your Excel data input
• PDF4me supports multiple input types
• Options: Binary Data, Base64 String, or URL
Binary Data
Input Binary Field***BinaryBinary Excel File Input (Required if Binary Data)
• Reference Excel file (.xlsx, .xls) from previous n8n node or file upload
• PDF4me processes binary Excel files with automatic format detection
• Required when Input Data Type is "Binary Data"
{{ $binary.data }}
Base64 Excel Content***StringBase64 Encoded Excel Input (Required if Base64 String)
• Provide Excel content (.xlsx, .xls) as base64 encoded string
• PDF4me automatically decodes and processes the Excel content
• Required when Input Data Type is "Base64 String"
UEsDBBQABgAI...
Excel URL***StringPublic Excel URL Input (Required if URL)
• Provide a public/open permission URL to the Excel file (.xlsx, .xls)
• PDF4me downloads and processes the Excel file from the provided URL
• Required when Input Data Type is "URL"
https://abc.com/data.xlsx
Excel Name***StringExcel Input Filename
• Specify the name of the input Excel file with proper extension (.xlsx, .xls)
• PDF4me uses this for format detection and processing optimization
data.xlsx
Phrases***StringJSON Array of Replacement Operations
• JSON string containing array of ReplacementPhrase objects
• Each object: SearchText* (string), ReplacementText* (string, can be empty to delete), IsExpression (bool, default: false - true = regex, false = literal text), CaseSensitive (bool, default: false), MatchEntireCell (bool, default: false - true = entire cell match, false = partial match), Formatting (TextFormatting object - optional: FontName, FontColor, FontSize, Bold/Italic, UnderlineType, StrikethroughType, ScriptType, etc.)
• Must contain at least one phrase
• Processed sequentially in array order
Matching: Literal text uses string comparison; Regex supports patterns and groups ($1, $2)
[{"SearchText":"old","ReplacementText":"new"}]
Binary Data Output Name***StringBinary Data Output Mapping
• Define the variable name for accessing generated Excel binary data
• Used in subsequent workflow actions
• Essential for workflow automation
document

Output

Output Parameters

ParameterTypeDescriptionExample
fileNameStringExcel document filename with text replaced - The name of the output Excel document file after text replacementexcel_replaced.xlsx
fileSizeNumberFile size in bytes - The size of the Excel document in bytes after text replacement212808
successBooleanPDF4me operation status - Boolean flag indicating the success or failure of the text replacement process. PDF4me returns true for successful operations and false for any errorstrue
originalFileNameStringOriginal Excel document filename - The name of the input Excel document filemyExcelFile.xlsx
operationsCountNumberNumber of replacement operations - The total count of replacement operations that were processed1
operationsArrayArray of replacement operations - Array of objects containing details about each replacement operation performed, including searchText, replacementText, isExpression, matchEntireCell, caseSensitive, and formattingApplied[{"searchText": "old ", "replacementText": "New", "isExpression": false, "matchEntireCell": false, "caseSensitive": false, "formattingApplied": false}]
cultureNameStringCulture/Locale code - Culture code used for document processing (e.g., "en-US", "de-DE", "fr-FR")en-US
messageStringOperation message - Descriptive message indicating the result of the text replacement operation, including the number of operations completedText replacement completed successfully with 1 operation(s)

N8N Action Response

The PDF4me Find and replace text API returns a response that can be viewed in multiple formats. Choose the view that best fits your needs:

JSON Response Format

The raw JSON response from the API:

[
{
"fileName": "excel_replaced.xlsx",
"fileSize": 212808,
"success": true,
"originalFileName": "myExcelFile.xlsx",
"operationsCount": 1,
"operations": [
{
"searchText": "old ",
"replacementText": "New",
"isExpression": false,
"matchEntireCell": false,
"caseSensitive": false,
"formattingApplied": false
}
],
"cultureName": "en-US",
"message": "Text replacement completed successfully with 1 operation(s)"
}
]

Note: Invalid phrases are logged as warnings but don't stop processing. Other valid phrases are still processed.

Use Cases

Data Standardization and Format Conversion

  • Replace inconsistent values with standard formats across Excel documents
  • Convert dates, phone numbers, or identifiers to standard formats
  • Standardize currency symbols and numeric formats

Error Correction and Content Updates

  • Fix misspellings and data entry errors automatically
  • Update product names, prices, or status values across multiple worksheets
  • Correct common typos and formatting inconsistencies

Privacy Masking and Data Protection

  • Replace sensitive data with masked values for external sharing
  • Mask PII (Personally Identifiable Information) using regex patterns
  • Apply data anonymization for compliance and privacy requirements

Get Help