Replace Text in Excel in Power Automate
PDF4me Replace Text in Excel action enables comprehensive search and replace operations in Excel documents in Power Automate with optional formatting application. This powerful text manipulation feature supports literal text replacement and 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), perfect for data standardization, content updates, error correction, and automated text transformation across all worksheets in Microsoft 365 workflows.
Authenticating Your API Request
To access the PDF4me Web API through Power Automate, every request must include proper authentication credentials. Authentication ensures secure communication and validates your identity as an authorized user, enabling seamless integration between your Power Automate flows and PDF4me's powerful Excel text replacement services.

Key Features
- Literal & Regex Support: Replace text using simple text matching or powerful regular expressions
- Case-Sensitive Option: Control case sensitivity for precise or flexible matching
- Entire Cell Matching: Match partial text or require entire cell match
- Multiple Replacements: Process multiple search-replace operations in single action
- Optional Formatting: Apply font, color, size, and style changes to replaced text
- All Worksheets Processing: Automatically processes all worksheets in workbook
Parameters
Complete list of parameters for the Replace Text in Excel 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.
| Parameter | Type | Description | Example |
|---|---|---|---|
| File Content*** | Base64 | Source Excel File Content • Map Excel file from previous action output • Supports Excel files from SharePoint, OneDrive, email attachments • Can be dynamically retrieved from flow variables • Must be valid Excel document (.xlsx, .xls formats) | [File Content from Get File] |
| File Name*** | String | Excel Document Name • Specify Excel file name with extension (.xlsx, .xls) • Used for processing and output file naming • Must include proper file extension • Supports dynamic naming from flow variables | data.xlsx |
| Phrases*** | Array | List of Replacement Operations • Array of ReplacementPhrase objects with properties: 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 (hex or name), FontSize, Bold/Italic (Apply/Remove/Inherit), UnderlineType, StrikethroughType, ScriptType (Subscript/Superscript), FontSchemeType, ThemeColour) • Must contain at least one phrase • Processed sequentially in array order • Matching: Literal text uses string comparison; Regex supports patterns and groups ($1, $2) • Invalid phrases logged as warnings but don't stop processing | [{"SearchText":"old","ReplacementText":"new"}] |
Output
The PDF4me Replace Text in Excel action returns comprehensive output data for seamless Power Automate flow integration:
- Table
- JSON
- Flow Integration
Table View
Response data in a structured table format:
| Parameter | Type | Description |
|---|---|---|
| document | Base64 | Excel document with text replaced |
| Success | Boolean | true if operation successful, false if failed |
| Error Message | String | Error description (null if successful) |
| Errors | Array | List of detailed error information (empty array if successful) |
JSON Response Format
The raw JSON response from the action:
{
"document": "[Base64 Excel Content with Text Replaced]",
"Success": true,
"ErrorMessage": null,
"Errors": []
}
Error Response Example:
{
"document": null,
"Success": false,
"ErrorMessage": "No replacement phrases provided",
"Errors": [
{
"Code": "PHRASE_ERROR",
"Message": "Phrases list cannot be null or empty"
}
]
}
Power Automate Flow Usage
Use Excel files with replaced text in subsequent actions:
- Data Standardization: Replace inconsistent values with standard formats
- Error Correction: Fix misspellings and data entry errors
- Content Updates: Update product names, prices, or status values
- Format Conversion: Convert dates, phone numbers, or identifiers to standard formats
- Privacy Masking: Replace sensitive data with masked values
- Email Distribution: Send updated Excel files to stakeholders
Common Error Messages
Understanding and troubleshooting errors helps ensure smooth Excel text replacement workflows:
| Error Message | Cause | Solution |
|---|---|---|
| "Request is empty" | Request object is null | Provide valid request object |
| "Document is empty" | Document object is null | Provide valid Excel document |
| "No replacement phrases provided" | Phrases list is null or empty | Provide at least one replacement phrase |
| "Skipping phrase with empty search text" | Phrase has null or empty SearchText (logged as warning) | Provide valid SearchText for all phrases |
| "Invalid regex pattern '{pattern}': {error}" | Invalid regex when IsExpression = true (logged as warning) | Fix regex syntax or escape special characters |
Note: Invalid phrases are logged as warnings but don't stop processing. Other valid phrases are still processed.
Workflow Examples
The PDF4me Replace Text in Excel action in Power Automate provides comprehensive workflow templates designed for real-world business scenarios:
- Data Standardization
- Privacy Masking
- Content Updates
- Error Correction
Automated Data Format Standardization Workflow
Transform your data quality with automated text replacement and formatting:
Complete Workflow Steps:
- Trigger: Data import Excel uploaded to "Processing" SharePoint folder
- Get Import File: Retrieve Excel file with inconsistent data
- Standardize Phone Numbers: Replace "(XXX) XXX-XXXX" with "XXX-XXX-XXXX" using regex
- Standardize Dates: Convert "MM/DD/YYYY" to "YYYY-MM-DD" format using regex groups
- Clean Titles: Replace "Mr.", "Mrs.", "Dr." with "Mr", "Mrs", "Dr" (no periods)
- Highlight Errors: Replace "ERROR" with red bold "ERROR" using formatting
- Set Phrases: Create array with all 4+ replacement operations
- Process File: Apply all replacements in single operation
- Upload Standardized: Save to "Standardized Data" folder
- Send Summary: Email data owner with standardization report
Business Benefits:
- Standardizes 200+ data rows weekly automatically
- Ensures consistent data formats across all imports
- Highlights errors with red formatting for easy identification
- Reduces manual data cleanup time by 85%
Automated Sensitive Data Masking Workflow
Streamline your data privacy with automated PII masking:
Complete Workflow Steps:
- Trigger: Excel report marked for external sharing
- Get Report: Retrieve Excel with sensitive information
- Mask SSNs: Replace SSN pattern "\d3-\d2-\d4" with "XXX-XX-XXXX"
- Mask Emails: Replace email regex with "[email protected]"
- Mask Phone Numbers: Replace phone pattern with "XXX-XXX-XXXX"
- Mask Credit Cards: Replace "\d4-\d4-\d4-\d4" with "XXXX-XXXX-XXXX-XXXX"
- Set All as Regex: IsExpression = true for all phrases
- Process Masking: Apply all privacy masks
- Verify Masked: Confirm no PII visible
- Email External: Send masked report to external stakeholders
Business Benefits:
- Masks PII in 50+ reports monthly automatically
- Ensures GDPR and privacy compliance
- Prevents accidental disclosure of sensitive information
- Enables safe external sharing of internal data
Automated Product Name Update Workflow
Optimize your content management with automated product name updates:
Complete Workflow Steps:
- Trigger: Product rebranding approved in product management system
- Get All Reports: Retrieve Excel files from reports library
- Loop Each File: Apply to each for all Excel reports
- Replace Old Product: SearchText = "OldProduct", ReplacementText = "NewProduct"
- Case Insensitive: CaseSensitive = false for flexible matching
- Match Partial: MatchEntireCell = false to catch all mentions
- Apply Bold: Add formatting to highlight updated product names
- Process Replacement: Update all occurrences across all worksheets
- Upload Updated: Save to "Updated Reports" folder
- Send Notification: Email report owners about product name changes
Business Benefits:
- Updates product names in 100+ Excel files during rebranding
- Ensures consistent product naming across all documents
- Highlights updated names with formatting for visibility
- Automates mass content updates saving 20+ hours
Automated Spelling and Error Correction Workflow
Enhance your data quality with automated error correction:
Complete Workflow Steps:
- Trigger: Weekly data quality check scheduled on Sunday at 2 AM
- Get Master Data: Retrieve customer database Excel from SharePoint
- Fix Common Typos: Create phrases for frequent misspellings
- Replace "Recieve": ReplacementText = "Receive"
- Replace "Occured": ReplacementText = "Occurred"
- Replace "Seperate": ReplacementText = "Separate"
- Fix Status Values: Replace "Complted" with "Completed"
- Set Case Insensitive: CaseSensitive = false for all
- Apply Formatting: Highlight corrected values in green
- Upload Corrected: Save to master data library
- Send Report: Email data quality report with correction count
Business Benefits:
- Corrects 30+ spelling errors weekly automatically
- Improves data quality and professionalism
- Highlights corrections for human review if needed
- Reduces manual proofreading time by 90%
Industry Use Cases & Applications
- Finance & Accounting
- Sales & Marketing
- Human Resources
- Healthcare & Medical
- Operations & Supply Chain
- Education & Research
Finance & Accounting Use Cases
- Currency Standardization: Replace currency symbols and formats
- Account Code Updates: Update chart of accounts codes across reports
- Status Value Correction: Fix common misspellings in transaction status
- Date Format Conversion: Standardize date formats in financial data
Sales & Marketing Use Cases
- Product Name Updates: Replace old product names with rebranded names
- Territory Changes: Update territory names across sales reports
- Status Standardization: Standardize lead status values (Open, Closed, Pending)
- Email Format Correction: Fix malformed email addresses
Human Resources Use Cases
- Department Name Changes: Update department names after reorganization
- Title Standardization: Standardize job titles across employee records
- Status Updates: Replace employment status values consistently
- Location Updates: Update office location names after moves
Healthcare & Medical Use Cases
- Code Standardization: Replace ICD codes or procedure codes
- Provider Name Updates: Update provider names after practice changes
- Status Correction: Fix common status value typos
- Privacy Masking: Mask patient identifiers in reports
Operations & Supply Chain Use Cases
- SKU Updates: Replace product SKUs after catalog changes
- Vendor Name Changes: Update vendor names after acquisitions
- Location Code Updates: Standardize warehouse location codes
- Status Value Fixes: Correct order status misspellings
Education & Research Use Cases
- Course Code Updates: Replace course codes after catalog changes
- Grade Value Standardization: Standardize grade values (A+, A, A-)
- Student ID Format: Standardize student ID formats
- Status Corrections: Fix enrollment status typos