Skip to main content

Merge multiple Excel files into a single multi-sheet file with summary page

Workflow preview

Workflow preview
100%
Merge multiple Excel files into a single multi-sheet file with summary page preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This workflow automates the process of merging multiple files from a designated folder into a single, well organized Excel workbook. Each input file is converted into its own sheet within the outpu...

Best for

  • Document Extraction automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.manualtrigger, n8n-nodes-base.splitinbatches, n8n-nodes-base.readwritefile, n8n-nodes-base.code, n8n-nodes-base.stickynote, n8n-nodes-base.extractfromfile, n8n-nodes-base.aggregate

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Simone.

Original n8n.io source

1.1 Workflow description

Title
Merge multiple Excel files into a single multi-sheet file with summary page
Workflow name
Merge multiple Excel files into a single multi-sheet file with summary page

Overview

This workflow automates the process of merging multiple .xlsx files from a designated folder into a single, well-organized Excel workbook. Each input file is converted into its own sheet within the output file. Additionally, a summary sheet is generated at the beginning, providing a convenient overview of all merged files, including their original names and the number of records in each.

This is particularly useful for consolidating reports, combining data from different sources, or archiving multiple spreadsheets into one manageable file.

How It Works

The workflow follows these key steps:

  1. Trigger: The process begins when you manually execute the workflow.
  2. Read Files: It reads all files ending with the .xlsx extension from the /n8n_files/ directory (ensure your volume is mapped correctly).
  3. Process Each File: The workflow iterates through each file one by one. For each file, it extracts the data from the first sheet.
  4. Collect and Clean Data: A custom code node gathers the data from all files. It cleans the data by removing any completely empty rows and prepares it for the final Excel generation. The original filename is used to name the new sheet.
  5. Generate Multi-Sheet Excel: The core logic resides in a code node that uses the xlsx library. It creates a new Excel workbook in memory, adds a sheet for each processed file, and populates it with the corresponding data. It also creates a "Summary" sheet that lists all the source files and their record counts.
  6. Save the Result: The final workbook is saved as a new .xlsx file in the /n8n_files/output/ directory with a timestamped filename (e.g., 合并文件_20250908T123000.xlsx).

Setup & Prerequisites

To use this workflow, you need to configure your n8n instance to allow and use the external xlsx npm module.

  1. Place Your Files: Put all the Excel files you want to merge into the folder that is mapped to /n8n_files/ in your n8n container.
  2. Enable External Module:
    • Set the following environment variable for your n8n service in your docker-compose.yml file:
      environment:
        - NODE_FUNCTION_ALLOW_EXTERNAL=xlsx
      
  3. Install the Module: You must build a custom Docker image for n8n that includes the xlsx library.
    • In the same directory as your docker-compose.yml, create a file named Dockerfile.
    • Add the following content to the Dockerfile:
      FROM n8nio/n8n:latest
      USER root
      RUN npm install xlsx
      USER node
      
    • In your docker-compose.yml, replace the image: n8nio/n8n... line with build: . for the n8n service.
    • Rebuild and restart your n8n container using docker-compose up --build -d.

Nodes Used

  • Manual Trigger: To start the workflow.
  • Read Write File: To read source files and save the final output file.
  • Split In Batches: To process files one by one.
  • Extract From File: To read the data from each .xlsx file.
  • Code: For custom JavaScript logic to process data and generate the final multi-sheet Excel file using the xlsx library.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When clicking ‘Execute workflow’

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 2 - Read each XLXS

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 3 - Read XLXS Files from Disk

Type / Role
n8n-nodes-base.readWriteFile - readWriteFile
Config choices
Version 1

Block 4 - Create Multi-Sheet Excel

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 5 - Collect and Process Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - 工作流启动与文件读取

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - 数据提取与处理

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - 生成与保存Excel文件

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Save XLXS to Disk

Type / Role
n8n-nodes-base.readWriteFile - readWriteFile
Config choices
Version 1

Block 10 - XLSX to Json List

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 11 - Mulipte Json to Single Json

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

3. Summary Table

Workflow Merge multiple Excel files into a single multi-sheet file with summary page
Complexity intermediate
Nodes 11
Categories Document Extraction
Author Simone
Published 08 Sept 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/8373/8373.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Merge multiple Excel files into a single multi-sheet file with summary page do?

This workflow automates the process of merging multiple files from a designated folder into a single, well organized Excel workbook. Each input file is converted into its own sheet within the outpu...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction use case.