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.
The workflow follows these key steps:
.xlsx
extension from the /n8n_files/
directory (ensure your volume is mapped correctly).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..xlsx
file in the /n8n_files/output/
directory with a timestamped filename (e.g., 合并文件_20250908T123000.xlsx
).To use this workflow, you need to configure your n8n instance to allow and use the external xlsx
npm module.
/n8n_files/
in your n8n container.docker-compose.yml
file:environment:
- NODE_FUNCTION_ALLOW_EXTERNAL=xlsx
xlsx
library.
docker-compose.yml
, create a file named Dockerfile
.Dockerfile
:FROM n8nio/n8n:latest
USER root
RUN npm install xlsx
USER node
docker-compose.yml
, replace the image: n8nio/n8n...
line with build: .
for the n8n service.docker-compose up --build -d
..xlsx
file.xlsx
library.