🌻 Txt to CSV Combiner
Merge a folder of text files into one CSV
- output_csv_path
Takes a folder full of .txt files and merges them into a single CSV - one row per file. It's the inverse of having a separate caption file per image: when you want all those loose text files collapsed into one spreadsheet you can sort, edit, and feed to something else, this is the node.
Where it fits
Caption datasets almost always start life as one .txt per image, sitting next to the images. That's the format trainers write and read. But sometimes you want the other view - everything in one CSV so you can eyeball it, clean it, translate a column, or hand it to a tool that expects a single table. Txt to CSV Combiner does that consolidation in one step, gathering a directory of text files into a tidy combined output. It's the natural counterpart to the pack's Text Saver, which scatters text out into individual files; this pulls them back together.
How it works
You point input_directory at the folder of .txt files and it reads them all, writing one row per file into a CSV at output_directory under output_filename. sort_by_filename orders the rows by filename so they line up predictably (important if your files are numbered to match images), and add_header optionally writes a header row at the top.
The inputs that matter
- input_directory - the folder of
.txtfiles to merge. Defaults to./input_txt_files. - output_directory / output_filename - where the combined CSV goes and what it's called.
- add_header - write a header row, or don't.
- sort_by_filename - keep this on so rows come out in filename order, matching numbered image sets.
The single output is output_csv_path, the full path to the CSV it wrote - chain it into a CSV Reader or a downstream tool.
Common issues
The one that matters is ordering. If your text files correspond to numbered images and you leave sort_by_filename off, the rows can land in arbitrary order and your CSV no longer lines up with the image sequence - keep sorting on for any dataset work. Second, it reads .txt files from the directory, so make sure the folder actually contains the text files you mean and not a mix of other formats. And add_header is a choice, not a default assumption downstream - if the tool you feed the CSV into expects no header (or requires one), set this to match, or you'll be off by a row.
Installing ComfyUI-Addoor
ComfyUI-Addoor (葵花宝典) is a utility pack from developer Eagle-CN with several CSV nodes. ComfyUI Manager: Install Custom Nodes → search "ComfyUI-Addoor" → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/Eagle-CN/ComfyUI-Addoor.git
cd ComfyUI-Addoor
pip install -r requirements.txt
Restart and find it under 🌻 Addoor / CSV.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| input_directory | STRING | ./input_txt_files | — |
| output_directory | STRING | ./output | — |
| output_filename | STRING | combined_output.csv | — |
| add_header | BOOLEAN | true | — |
| sort_by_filename | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output_csv_path | STRING | — |