Merge Rows in Excel in Power Automate
PDF4me Merge Rows in Excel action enables intelligent consolidation of duplicate rows in Excel documents by grouping based on key columns in Power Automate with automatic value merging. This powerful data consolidation feature identifies duplicate rows using specified key columns (or all columns), combines values from non-key columns using semicolon-separated format, removes duplicate values within merged cells, and supports multiple output formats (XLSX, XLS, XLSB, CSV), perfect for customer order consolidation, data deduplication, category aggregation, and multi-row record combination across 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 row merging services.

Key Features
- Intelligent Row Grouping: Group duplicate rows based on specified key columns
- Value Consolidation: Merge values from non-key columns with semicolon separator
- Duplicate Detection: Automatically identify and consolidate duplicate records
- Multiple Worksheet Support: Process multiple worksheets in single operation
- Flexible Key Selection: Use specific columns as keys or all columns for exact duplicates
- Multiple Output Formats: Save as XLSX, XLS, XLSB, or CSV
Parameters
Complete list of parameters for the Merge Rows in Excel action. Configure these parameters to control row merging.
Important: Parameters marked with an asterisk (***) are required. Both worksheet and column numbers use 1-based indexing (1 = first worksheet, 1 = column A).
| 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 |
| Worksheet Numbers*** | String | Comma-Separated Worksheet Numbers (1-based) • List of worksheet numbers to process • Format: "1,2,3" (1 = first worksheet) • Required - at least one worksheet • 1-based indexing | 1,3,5 |
| Merge Key Columns | String | Comma-Separated Key Column Numbers (1-based) • Columns to use as merge keys (1 = column A, 2 = column B, etc.) • Key columns: Identify duplicate rows - values from first occurrence kept • Value columns (non-key): Get merged with "; " separator - duplicate values removed • Empty = all columns: Removes exact duplicate rows only (no value merging) • Merge Logic: Collects non-empty values from duplicates → Removes duplicate values → Joins with "; " • 1-based indexing | 1,2 |
| Output Format | String | Output File Format • "XLSX" - Excel 2007+ (.xlsx) - Default, best compatibility • "XLS" - Excel 97-2003 (.xls) - Legacy system compatibility • "XLSB" - Excel Binary Workbook (.xlsb) - Faster performance, smaller file size • "CSV" - Comma-separated values (.csv) - Simple format, data import • Case-insensitive, output filename: "merged_rows" with appropriate extension | XLSX |
Output
The PDF4me Merge Rows 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 merged rows |
| FileName | String | Output filename: "merged_rows.xlsx" (or .xls, .xlsb, .csv based on format) |
| 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 Merged Rows]",
"FileName": "merged_rows.xlsx",
"Success": true,
"ErrorMessage": null,
"Errors": []
}
Error Response Example:
{
"document": null,
"FileName": null,
"Success": false,
"ErrorMessage": "Invalid worksheet selection",
"Errors": [
{
"Code": "WORKSHEET_ERROR",
"Message": "Worksheet 10 not found. Available worksheets in workbook (5 total)"
}
]
}
Power Automate Flow Usage
Use Excel files with merged rows in subsequent actions:
- Data Consolidation: Combine multiple entries for same entities into single rows
- Duplicate Removal: Clean datasets by removing exact duplicate rows
- Customer Aggregation: Merge customer transactions into consolidated records
- Report Simplification: Reduce row count while preserving all data
- Email Distribution: Send deduplicated Excel files to stakeholders
- SharePoint Publishing: Upload consolidated Excel files to document libraries
Common Error Messages
Understanding and troubleshooting errors helps ensure smooth Excel row merging 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 |
| "Invalid worksheet selection" | Worksheet number out of range or invalid format | Use valid worksheet numbers (1-based) within workbook |
| "Available worksheets in workbook (X total)" | Informational message when worksheet validation fails | Use worksheet numbers from 1 to X |
| "Worksheet {number} not found" | Worksheet number exceeds total worksheet count | Use valid worksheet numbers (1 to total count) |
| "Error processing file: {message}" | Generic processing error during merge operation | Check file integrity, data structure, and parameter values |
Workflow Examples
The PDF4me Merge Rows in Excel action in Power Automate provides comprehensive workflow templates designed for real-world business scenarios:
- Customer Consolidation
- Duplicate Removal
- Category Aggregation
- Multi-Entry Consolidation
Automated Customer Order Consolidation Workflow
Transform your customer reporting with automated order consolidation by customer:
Complete Workflow Steps:
- Trigger: Daily order export completed at 11 PM
- Get Order Export: Retrieve daily orders Excel from SharePoint
- Merge by Customer: Set MergeKeyColumns = "1" (CustomerID column)
- Target Worksheet: WorksheetNumbers = "1" (Orders sheet)
- Set Output: OutputFormat = "XLSX"
- Process Merge: Consolidate all orders per customer
- Result: One row per customer with all OrderIDs, Products, Amounts merged
- Email Sales: Send consolidated customer view to sales team
- Archive: Store in daily consolidated reports folder
Business Benefits:
- Consolidates 200+ daily orders into customer-level summary
- Provides single-row view of all customer purchases
- Simplifies sales analysis with deduplicated customer data
- Reduces report complexity by 70% while preserving all information
Automated Exact Duplicate Row Removal Workflow
Streamline your data cleanup with automated duplicate row removal:
Complete Workflow Steps:
- Trigger: Data import Excel uploaded to "Cleanup" SharePoint folder
- Get Import File: Retrieve Excel file with potential duplicates
- Remove Duplicates: Set MergeKeyColumns = "" (empty - all columns as keys)
- Process All Sheets: WorksheetNumbers = "1,2,3"
- Set Output: OutputFormat = "XLSX"
- Merge Process: Removes rows that are 100% identical
- Verify Row Count: Compare before/after row counts
- Upload Cleaned: Save deduplicated file to "Cleaned Data" folder
- Send Summary: Email data owner with removal statistics
Business Benefits:
- Removes 50+ exact duplicate rows weekly from imports
- Improves data quality by eliminating redundant records
- Reduces Excel file size by removing duplicate data
- Automates data cleanup saving 5 hours weekly
Automated Product Category Aggregation Workflow
Optimize your inventory reporting with automated category-level consolidation:
Complete Workflow Steps:
- Trigger: Weekly inventory report generation on Sunday at 11 PM
- Get Inventory Report: Retrieve detailed inventory Excel from system
- Merge by Category: Set MergeKeyColumns = "1,2" (Category, Subcategory)
- Target Inventory Sheet: WorksheetNumbers = "1"
- Value Merging: ProductIDs, SKUs, Quantities get merged per category
- Set Output: OutputFormat = "XLSX"
- Result: One row per category/subcategory with all products listed
- Email Purchasing: Send aggregated view to purchasing team
- Archive Report: Store in weekly inventory summaries library
Business Benefits:
- Aggregates 500+ product rows into 50 category summaries
- Provides high-level inventory view by category
- Maintains detailed product information in merged cells
- Simplifies purchasing decisions with category-level data
Automated Employee Timesheet Consolidation Workflow
Enhance your payroll processing with automated timesheet entry consolidation:
Complete Workflow Steps:
- Trigger: Bi-weekly payroll period ends on Friday at 5 PM
- Get Timesheet Entries: Retrieve Excel with multiple entries per employee
- Merge by Employee: Set MergeKeyColumns = "1,2" (EmployeeID, PayPeriod)
- Target Timesheets: WorksheetNumbers = "1"
- Consolidate Entries: Project codes and hours merged per employee
- Set Output: OutputFormat = "XLSX"
- Result: One row per employee with all projects and total hours
- Validate Totals: Verify merged hour calculations
- Email Payroll: Send consolidated timesheet to payroll team
- Archive: Store in payroll processing folder
Business Benefits:
- Consolidates 300+ timesheet entries into employee summaries
- Provides single-row view per employee for payroll processing
- Preserves all project codes and hours in merged format
- Reduces payroll processing time by 60%
Industry Use Cases & Applications
- Sales & E-Commerce
- Finance & Accounting
- Human Resources
- Operations & Supply Chain
- Customer Service & Support
- Healthcare & Medical
Sales & E-Commerce Use Cases
- Customer Order Consolidation: Merge multiple orders per customer into single rows
- Product Sales Aggregation: Consolidate sales by product across multiple transactions
- Territory Rollup: Merge sales data by territory or region
- Duplicate Lead Removal: Remove exact duplicate leads from marketing lists
Finance & Accounting Use Cases
- Transaction Consolidation: Merge transactions by account or vendor
- GL Entry Aggregation: Consolidate general ledger entries by account code
- Expense Rollup: Merge expense entries by employee or department
- Duplicate Invoice Removal: Remove exact duplicate invoice entries
Human Resources Use Cases
- Timesheet Consolidation: Merge timesheet entries by employee and pay period
- Training Records Aggregation: Consolidate training completions by employee
- Benefits Enrollment: Merge enrollment selections by employee ID
- Duplicate Employee Cleanup: Remove duplicate employee records
Operations & Supply Chain Use Cases
- Inventory Consolidation: Merge inventory records by location and product
- Supplier Order Aggregation: Consolidate purchase orders by supplier
- Shipment Tracking: Merge shipment entries by tracking number
- Quality Control Rollup: Aggregate QC results by batch or lot number
Customer Service & Support Use Cases
- Ticket Consolidation: Merge support tickets by customer and issue category
- Feedback Aggregation: Consolidate customer feedback by product
- Contact Deduplication: Remove duplicate contact entries
- Interaction History: Merge customer interactions by customer ID
Healthcare & Medical Use Cases
- Patient Visit Consolidation: Merge patient visits by patient ID and date
- Lab Result Aggregation: Consolidate lab results by patient and test type
- Appointment Rollup: Merge appointments by patient and provider
- Prescription History: Consolidate prescriptions by patient ID