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 fil...
Template notes
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 /n8nfiles/ 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 /n8nfiles/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.