Nodes/CSV Load One Line/CSVLoadOneLineNoDelete
ComfyUI Node

CSVLoadOneLineNoDelete

Read one CSV line per run without nuking your file

By scofano·Created 10 months ago·Updated 5 months ago· 0
CSVLoadOneLineNoDelete
    • first_column
    • second_column
    • third_column
    • full_line
    file_pathE:\ComfyUI_windows_portable\ComfyUI\output\prompts.csv
    seed0

    The polite half of the comfy-csv-load-one-line pack. Its sibling CSVLoadOneLine reads a line and then deletes it from the file - great for batch-and-burn, terrifying for everything else. This one, CSVLoadOneLineNoDelete (node menu title: "CSV Load One Line (No Delete)"), reads a line by index, hands it to your graph, and never touches the file. Same output shape, none of the destructive side effects. If you're batch-running prompts from a CSV, this is the one you actually want in a workflow you care about.

    How it works

    The seed input does double duty here: it's your line index, and it's a progress pointer. The node reads the whole file, then picks line_index = seed % total_lines. That modulo is important - it means the index wraps around, so when you reach the last line the next run cycles back to the top instead of erroring. And the seed widget is declared with control_after_generate: "increment", so after every run the counter bumps by one on its own. The net effect: queue the workflow N times and it walks the file one line at a time, then starts over. You get a loop without touching anything.

    Two deliberate side effects worth knowing. First, because the file is never modified, re-running the workflow re-reads the same line unless the seed moves - which is exactly the reproducibility you want when debugging. Second, that auto-increment means the seed shown in the box is the one that ran, not the next one, which is the opposite of the classic control_after_generate trap documented in comfyui-node-plumbing.md. Flip it to fixed if you want to pin a specific line.

    The inputs and outputs that matter

    • file_path (STRING) - full path to your CSV. The default is E:\ComfyUI_windows_portable\ComfyUI\output\prompts.csv, the author's own Windows layout; you'll type over it. Use an absolute path, since the check resolves relative to wherever ComfyUI is running.
    • seed (INT, default 0) - the 0-based line index, auto-incrementing and cycling via modulo.
    • Outputs: first_column, second_column, third_column, full_line, all STRING. Missing columns come back as empty strings, so a two-column CSV just yields an empty third_column. Wire the columns into CLIP Text Encode nodes for your positive/negative prompts, or use full_line if you'd rather parse it yourself.

    Installing it

    No dependencies, no models, no requirements.txt to babysit - the pack is pure stdlib (csv + os). Install from ComfyUI Manager by searching "CSV Load One Line", or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/scofano/comfy-csv-load-one-line
    

    Restart ComfyUI and the two nodes appear under the "CSV Load One Line" category. Because there are zero Python dependencies, it won't fight your other custom nodes - which, given how dependency conflicts are the default complaint in the ecosystem, is a quietly nice property.

    Where people get burned

    • Semicolon delimiter, not comma. The node splits on ; via csv.reader. A standard comma-delimited CSV becomes one giant first_column with the other two empty. This is the single most common "it's not working" report for this pack, and it's not in the node UI anywhere.
    • It starts at 0 and wraps. If your CSV has a header row, that header is line index 0 - you'll happily feed "prompt;negative;style" into a sampler. Skip or delete the header first.
    • UTF-8 BOM. Excel's "CSV UTF-8" export prepends a byte-order mark, and the node reads with utf-8 (not utf-8-sig), so the first column of the first line can carry a stray \ufeff. If the first prompt looks subtly off, that's your culprit.
    • File must exist. A bad path raises ValueError: File not found: ... rather than a gentle warning, so check the path before you queue a long batch.

    For a small utility this is remarkably close to the "just works" ideal: one input you care about, four string outputs, and no surprises in the file. The destructive sibling gets the attention; this one gets the production workflows.

    CategoryCSV Load One Line

    Inputs (2)

    NameTypeDefaultDescription
    file_pathSTRINGE:\ComfyUI_windows_portable\ComfyUI\output\prompts.csv
    seedINT00–18446744073709550000

    Outputs (4)

    NameTypeDescription
    first_columnSTRING
    second_columnSTRING
    third_columnSTRING
    full_lineSTRING