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.

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.

Important: Parameters marked with an asterisk (***) are required. Each document in the Documents list requires Base64-encoded file content.

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
Documents***ArrayList of Files to Merge
• Array of MergeDocument objects with properties: FileContent* (Base64), Filename* (string), SortPosition (number, default: 0, ascending order), WorksheetsToMerge (array of worksheet names, empty = all worksheets)
• Must contain at least one document
• Processed in SortPosition order (lower numbers first)
Conflict Resolution: Duplicate worksheet names automatically renamed with suffix (e.g., Sheet1, Sheet1_1, Sheet1_2)
[{"FileContent":"...", "Filename":"jan.xlsx", "SortPosition":1}]
Output FormatEnumOutput File Format
XLSX (default) - Excel 2007+ (.xlsx extension)
XLS - Excel 97-2003 (.xls extension)
PDF - PDF document (.pdf extension) - read-only distribution, archival
CSV - Comma-separated values (.csv extension) - Note: CSV output only includes first worksheet
• Default: XLSX
XLSX
Output File NameStringOutput Filename (without extension)
• Name for merged output file
• Extension automatically added based on OutputFormat
• Default: "merged" if empty
• Do not include file extension
Q1_Report

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:

ParameterTypeDescription
documentBase64Merged Excel file (or PDF/CSV based on OutputFormat)
FileNameStringGenerated filename with appropriate extension
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 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