Skip to main content

Merge multiple Excel files using n8n action

PDF4me Merge Excel Files stitches together any number of workbooks from your n8n workflow. Provide a document list (each with file content, filename, optional worksheet filters, and ordering), then pick an output format (XLSX, XLS, PDF, or CSV). PDF4me automatically handles worksheet name collisions by appending numeric suffixes.

Setup

Add the PDF4me “Merge Files” node to your n8n workflow and configure the required parameters. For initial setup instructions, see our n8n Integration Guide.

Prerequisites

  • PDF4me API credentials
  • n8n workflow access

Configuration

  1. Add the PDF4me node to the workflow
  2. Select the "Merge multiple Excel files" action
  3. Build the Documents array and choose the output format
Merge Excel Files

Parameters

Important: Parameters marked with an asterisk (***) are required. Each entry inside Documents must include FileContent (base64) and Filename.

ParameterTypeDescriptionExample
File Name***StringLogical name for the primary workflow file (used as reference).merged.xlsx
Documents***ArrayArray of merge items. Each item requires:
FileContent (Base64) – workbook bytes
Filename – e.g., north.xlsx
SortPosition – optional number; lower values merged first
WorksheetsToMerge – optional string array of worksheet names to include; empty = all sheets
[{"FileContent":"...","Filename":"north.xlsx","SortPosition":1,"WorksheetsToMerge":["Summary"]}]
Output FormatStringXLSX (default), XLS, PDF, or CSV. CSV exports only the first worksheet.XLSX
Output File NameStringName (without extension) for the merged result. Default merged.Quarterly_Report
Binary Data Output Name***StringBinary slot to store the merged document.document

Use n8n expressions or the Function node to assemble the Documents array when merging dynamic file counts.

Output

Output Parameters

ParameterTypeDescriptionExample
fileNameStringMerged workbook filename - The name of the output merged Excel filemerged-workbook.xlsx
fileSizeNumberFile size in bytes - The size of the merged Excel file in bytes440413
successBooleanPDF4me operation status - Boolean flag indicating the success or failure of the file merging process. PDF4me returns true for successful operations and false for any errorstrue
outputFormatStringOutput file format - The format of the merged output file. Values: "XLSX", "XLS", "PDF", "CSV"XLSX
filesCountNumberNumber of files merged - The total count of Excel files that were merged2
filesMergedArrayArray of merged file details - Array of objects containing information about each file that was merged, including filename, sortPosition, and worksheets[{"filename": "file1.xlsx", "sortPosition": 1, "worksheets": "all"}]
messageStringOperation message - Descriptive message indicating the result of the file merging operation, including the number of files merged and output formatSuccessfully merged 2 Excel file(s) into XLSX format

N8N Action Response

The PDF4me Merge multiple Excel files API returns a response that can be viewed in multiple formats. Choose the view that best fits your needs:

JSON Response Format

The raw JSON response from the API:

[
{
"fileName": "merged-workbook.xlsx",
"fileSize": 440413,
"success": true,
"outputFormat": "XLSX",
"filesCount": 2,
"filesMerged": [
{
"filename": "file1.xlsx",
"sortPosition": 1,
"worksheets": "all"
},
{
"filename": "file2.xlsx",
"sortPosition": 1,
"worksheets": "all"
}
],
"message": "Successfully merged 2 Excel file(s) into XLSX format"
}
]

Use Cases

  • Regional report consolidation: Merge regional workbooks into one national report ordered by SortPosition.
  • Department submissions: Combine department worksheets while only keeping specific tabs (e.g., Summary, KPIs).
  • Distribution-ready bundles: Merge multiple Excel sources then convert to PDF for leadership review.

Get Help