D2 Load CSV
Load them from a CSV instead
- output
- lines_count
- file_path
Ever found yourself pasting a spreadsheet of prompt ideas into ComfyUI one row at a time? That's the problem D2 Load CSV exists to kill. It reads a CSV or TSV file straight off disk, slices out the rows and columns you care about, and hands them to the rest of your graph. No intermediate text node, no manual copy-paste, no leaving the file open in Excel and praying.
It comes from D2 Nodes, a Japanese author's (da2el-ai) grab-bag of "slightly convenient" nodes. Its natural home is batch work: a list of prompts for a prompt-matrix or XY plot run, a tag list to append to captions, a set of names for a character batch. The moment your inputs live in a file that changes, this node earns its keep.
How it works
Under the hood it's honest-to-goodness csv.reader with a range slicer on top. The clever bit is row_index / column_index, which take 1-based range strings - the same syntax you'd use in a spreadsheet's print range:
3- just the 3rd row (or column)2-- from the 2nd to the end-4- everything through the 4th2-4- rows 2 through 4
Leave both blank and you get the whole file. And a malformed range (like 0 or 2--4) doesn't silently give you garbage - it raises an error and stops the workflow on purpose, so bad data never flows downstream. That's a design decision worth respecting.
Two other touches show the author cares. encode_to_utf8 flips on charset auto-detection (via charset-normalizer) for files that aren't UTF-8, which is the difference between a clean Japanese/Chinese prompt list and a wall of ���. And the node tracks the file's last-modified time, so if you edit the CSV in another app and re-run, it re-reads it instead of serving a stale cached copy.
Inputs and outputs that matter
- file_path - the full path to your file, e.g.
C:/data/prompts.csv. Path with spaces is fine; quotes around it are not. - file_type -
csv(comma) ortsv(tab). Pick whatever your file actually is. - output_mode -
listgives you a 2D array (rows of lists) for string nodes that expect lists;csvgives you reformatted text joined with newlines and commas, handy when you want to feed a plain STRING. - row_index / column_index - the range strings above.
- use_doublequote - only matters in
csvoutput mode:truequotes every cell, so commas inside a cell don't split it. Leave it on unless you know why you're turning it off.
Outputs are output (your data, type depends on output_mode), lines_count (row count of the selected range - handy as a loop bound), and file_path (a passthrough of what you typed in).
Installing it
Grab the whole pack through ComfyUI Manager (search "D2 Nodes"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/da2el-ai/D2-nodes-ComfyUI
Restart ComfyUI. The pack's requirements.txt is tiny (piexif, charset-normalizer), and there are no model downloads - nothing heavy here. One real gotcha: since v32.0.0 the pack moved to the ComfyUI V3 node schema. On an older ComfyUI install the nodes won't appear, so update ComfyUI, or pin the pack to a pre-32.0.0 release.
Where people get burned
A missing file doesn't crash - it quietly returns empty output and lines_count of 0, so the first symptom is a blank batch. Check your path spelling first. Second: garbled text usually means the file isn't UTF-8 and encode_to_utf8 is off. And if your rows show up with extra columns or merged cells, your file uses a delimiter that isn't the one you picked - switch file_type.
For what it costs, it's the rare node that replaces an entire category of copy-paste busywork.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| file_path | STRING | — | |
| file_type | COMBO | csv | 2 options: csv, tsv |
| encode_to_utf8 | BOOLEAN | false | — |
| output_mode | COMBO | csv | 2 options: list, csv |
| row_index | STRING | — | |
| column_index | STRING | — | |
| use_doublequote | BOOLEAN | false | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| output | * | — |
| lines_count | INT | — |
| file_path | STRING | — |