Load Lines From Text File
Turn a .txt file into a grid of prompts, no copy-paste required
- LIST
This is the node you'll actually reach for if you've ever copied a prompt in and out of a text widget thirty times to test variations. Load Lines From Text File reads a plain .txt file from your ComfyUI input/ folder and hands you a LIST with one line per item - built specifically to feed the row or column lists of this pack's XY Grid Helper. Keep a file of prompts, styles, or negative prompts on disk, and a whole sweep becomes "pick file, queue, done."
It comes from kenjiqq/qq-nodes-comfyui, the small XY-grid pack that r/comfyui recommends when Efficiency nodes' XY plot breaks: the community line is that it's "verbose but allows you to XY basically anything." This node is how you stop being verbose - your values live in a file, not in the graph.
What it does
One input, one output:
- file - a dropdown of every
.txtfile in your ComfyUIinput/folder. Pick one and the node reads it top to bottom. - LIST - the output. Each line of the file is one element.
That's the whole thing. Wire LIST into the row_list or column_list input of XY Grid Helper, and every prompt in that file becomes a row (or column) of your grid.
How it actually works
Three details in the source matter for everyday use:
- The dropdown is built when the node loads. The file list comes from
folder_paths.get_input_directory(), scanned for.txtfiles. Add a new file and it won't appear until you refresh the node or restart ComfyUI. - It re-reads when the file changes. The node hashes the file (
IS_CHANGED) and only re-reads when the hash differs. So editingprompts.txtmid-session picks up the change on the next queue - you don't need to touch the node, only the file. readlines()keeps the newline. Every line comes out with a trailing\n. Usually harmless - CLIP Text Encode trims it - but if you're feeding the string into something strict, expect it.
The gotchas
- Blank lines become empty strings. A stray empty line in the file becomes an empty prompt in your grid. It won't error, it'll just silently give you a blank row.
- It's line-based, not delimiter-based. A line that contains a comma stays whole - this is the file-based counterpart to Text Splitter, and they don't mix rules. If your "line" is actually comma-separated values, use Text Splitter instead.
- Trailing whitespace sticks.
"my prompt "stays padded. Harmless for most text encoders, infuriating if you're checking string equality downstream.
Installing it
This pack has no requirements.txt - it's pure Python/JS using only libraries ComfyUI already ships (torch, PIL, numpy, torchvision). The only extra you might need is images-grid-comfy-plugin (LEv145) if you use the XY Grid nodes, and WAS Node Suite is optional - the README uses it in one example to convert strings to other types.
cd ComfyUI/custom_nodes
git clone https://github.com/kenjiqq/qq-nodes-comfyui
Then restart ComfyUI. Or use ComfyUI Manager: search qq-nodes-comfyui and install from there.
Common issues
- "My file isn't in the dropdown." Refresh the node or restart - the list is only scanned at node creation.
- "Invalid text file" error. The file moved or was deleted after the dropdown was built. Re-pick the file.
- Blank rows in the grid. That's your empty lines. Curate the file.
- Changes not picked up. You edited the file but the hash check should catch it; if it doesn't, re-select the file in the dropdown to force a re-read.
One tip: because it's just a LIST, you're not limited to prompts. Checkpoint names, seeds, LoRA names - anything you want to sweep one-value-per-line, this loads it the same way.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| file | COMBO | 0 options: |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LIST | LIST | — |