Skip to main content

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.

Replace Text in Excel Power Automate

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.

ParameterTypeDescriptionExample
File Content***Base64Source 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***StringExcel 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***ArrayList 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 View

Response data in a structured table format:

ParameterTypeDescription
documentBase64Excel document with text replaced
SuccessBooleantrue if operation successful, false if failed
Error MessageStringError description (null if successful)
ErrorsArrayList of detailed error information (empty array if successful)

Common Error Messages

Understanding and troubleshooting errors helps ensure smooth Excel text replacement workflows:

Error MessageCauseSolution
"Request is empty"Request object is nullProvide valid request object
"Document is empty"Document object is nullProvide valid Excel document
"No replacement phrases provided"Phrases list is null or emptyProvide 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:

Automated Data Format Standardization Workflow

Transform your data quality with automated text replacement and formatting:

Complete Workflow Steps:

  1. Trigger: Data import Excel uploaded to "Processing" SharePoint folder
  2. Get Import File: Retrieve Excel file with inconsistent data
  3. Standardize Phone Numbers: Replace "(XXX) XXX-XXXX" with "XXX-XXX-XXXX" using regex
  4. Standardize Dates: Convert "MM/DD/YYYY" to "YYYY-MM-DD" format using regex groups
  5. Clean Titles: Replace "Mr.", "Mrs.", "Dr." with "Mr", "Mrs", "Dr" (no periods)
  6. Highlight Errors: Replace "ERROR" with red bold "ERROR" using formatting
  7. Set Phrases: Create array with all 4+ replacement operations
  8. Process File: Apply all replacements in single operation
  9. Upload Standardized: Save to "Standardized Data" folder
  10. 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%

Industry Use Cases & Applications

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

Get Help