Skip to main content

Merge Excel Files in Power Automate

PDF4me Merge Excel Files action enables combining multiple Excel files into a single consolidated workbook in Power Automate with intelligent worksheet merging and format conversion. This powerful file consolidation feature supports merging all or selective worksheets from multiple source files, automatic worksheet name conflict resolution with suffix numbering, flexible sort ordering, and multiple output formats (XLSX, XLS, PDF, CSV), perfect for report consolidation, data aggregation, and multi-source Excel file combination across Microsoft 365 workflows.

Related Blog Posts
No blog post yet for this feature — coming soon.
In the meantime, browse the PDF4me blog for tutorials and workflows across every platform.
Visit the blog →

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 file merging services.

Merge Excel Files Power Automate

Key Features​

  • Multiple File Merging: Combine unlimited Excel files into one workbook
  • Selective Worksheet Merging: Choose specific worksheets or merge all
  • Automatic Conflict Resolution: Duplicate worksheet names automatically renamed
  • Sort Control: Specify merge order with SortPosition property
  • Multiple Output Formats: Save as XLSX, XLS, PDF, or CSV
  • Content Preservation: Full worksheet content and formatting copied

Parameters​

Complete list of parameters for the Merge Excel Files action. Configure these parameters to control file merging.

ParameterRequiredWhat it doesExample
Output File NameOptionalName for the merged file, without the extension.Q1_Report
Output FormatOptionalFormat for the merged output file. Options: XLSX, XLS, PDF, CSV. Defaults to `XLSX`.XLSX
Documents to MergeOptionalThe files to merge. Add one item per file, or switch to input entire array and map an array of objects with Filename, FileContent, SortPosition and, optionally, WorksheetsToMerge.your value
FilenameRequiredName of the file, including its extension (for example `sales.xlsx`). Defaults to `MergeFiles.xlsx`.sales.xlsx
File ContentRequiredContent of the file. Map it from the file content returned by a previous action.[File Content from Get File]
Sort PositionRequiredPosition in merge order (lowest first).0
Worksheets to MergeConditionalNames of the worksheets to take from this file. Shown when Documents to Merge is set.your value

Output​

The PDF4me Merge Excel Files action returns comprehensive output data for seamless Power Automate flow integration:

Table View

Response data in a structured table format:

FieldTypeWhat it contains
Merged File ContentFile contentContent of the merged file, in the chosen Output Format. Map it into the next action, for example the File Content field of SharePoint or OneDrive Create file.
SuccessYes/NoWhether the operation completed successfully
Error MessageTextError message if operation failed
Error DetailsArrayList of detailed error messages

Common Error Messages​

Understanding and troubleshooting errors helps ensure smooth Excel file merging workflows:

Error MessageCauseSolution
"Request is empty"Request object is nullProvide valid request object
"File content is empty for file {filename}"FileContent is null or empty stringProvide valid Base64-encoded file content
"No matching worksheets found in {filename}"WorksheetsToMerge specified but none exist in fileVerify worksheet names match exactly (case-sensitive)
"Error processing file {filename}: Invalid Base64 string"FileContent is not valid Base64Encode file content as Base64 before sending
"Error processing file {filename}: File is corrupted"Source Excel file is corrupted or invalidProvide valid, non-corrupted Excel files
"Error processing file {filename}: Unsupported format"File format not supportedUse .xlsx or .xls format files only

Workflow Examples​

The PDF4me Merge Excel Files action in Power Automate provides comprehensive workflow templates designed for real-world business scenarios:

Automated Monthly Report Consolidation Workflow

Transform your reporting with automated merging of monthly department reports:

Complete Workflow Steps:

  1. Trigger: Scheduled trigger on 5th of month at 9 AM
  2. Get Department Reports: Retrieve Excel files from SharePoint folder (Sales, Marketing, Finance)
  3. Build Documents Array: Create MergeDocument objects for each file
  4. Set Sort Order: SortPosition = 1 (Sales), 2 (Marketing), 3 (Finance)
  5. Select Worksheets: WorksheetsToMerge = ["Summary", "Data"] for each
  6. Merge Files: Combine into single workbook
  7. Set Output: OutputFileName = "Monthly_Report_[Month]", OutputFormat = XLSX
  8. Email Leadership: Send consolidated report to executive team
  9. Archive: Store merged report in monthly reports library

Business Benefits:

  • Consolidates 3 department reports monthly automatically
  • Eliminates manual file merging saving 1 hour per month
  • Ensures consistent report structure with worksheet selection
  • Provides single source of truth for monthly performance

Industry Use Cases & Applications​

Finance & Accounting Use Cases

  • Monthly Close: Merge departmental financial reports into consolidated monthly close
  • GL Consolidation: Combine general ledger exports from multiple entities
  • Budget Aggregation: Merge departmental budgets into company-wide budget
  • Audit Preparation: Consolidate financial records from multiple sources

Get Help​