ComfyUI Node

CSV Prompt Loader

CSV Prompt Loader — your prompt library in a spreadsheet, selected from a dropdown

By marcoc2·Created 2 years ago·Updated 5 months ago· 1
CSV Prompt Loader
    • prompt
    • negative_prompt
    csv_path
    selected_name

    Keeping a dozen good prompts around as text files is chaos. Keeping them in a spreadsheet - one row per prompt, with a name, the positive, and the negative - is organized. CSVPromptLoader turns that spreadsheet into a dropdown in your graph: load a CSV, pick a named entry, and get its prompt and negative prompt out as clean STRING outputs.

    It's the node for people who treat their prompt collection like a reference library. Batch renderers, A/B testers, and anyone who wants prompt variety without retyping will find a home for it. And because it separates the "library" from the "graph," you can edit prompts in the CSV without touching your workflow at all.

    How it works

    The CSV format is fixed and simple: three columns, a header row, name, prompt, negative_prompt. Each row becomes one entry in a dropdown. When you pick a name, the node returns that row's prompt and negative prompt.

    The neat engineering bit is a class-level cache: the CSV data is loaded once and shared across all instances of the node. That means if you have three CSVPromptLoader nodes in your graph, they all see the same dropdown populated from every loaded file, and none of them re-read the CSV on every execution. It's a small detail that makes the node feel responsive instead of laggy.

    There's a tiny chicken-and-egg to work around: the dropdown options come from the cache, so on a fresh node you'll see the placeholder "No CSV loaded". Type or paste your csv_path, let it execute once, and the dropdown repopulates with your names.

    Inputs and outputs

    • csv_path (STRING) - path to the CSV file. Raw string, no picker - paste the full path.
    • selected_name - the dropdown of entries from all loaded CSVs.
    • Outputs prompt and negative_prompt (both STRING).

    Wire prompt into a text encoder's positive and negative_prompt into the negative, and you've got a library-driven generation setup.

    Installing it

    Part of the AnotherUtils pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/marcoc2/ComfyUI-AnotherUtils.git
    

    Restart ComfyUI, or install via ComfyUI Manager (search "AnotherUtils"). Pure CSV parsing - the stdlib csv module - so no extra dependencies.

    Gotchas

    Three things trip people up. First, the dropdown only populates after the CSV has actually been read once - if you set the path and see nothing, force a queue run. Second, it's strict about the format: it expects exactly the name, prompt, and negative_prompt columns. If your CSV has extra columns or different headers, rows get silently skipped, and the node falls back to empty strings rather than telling you. A stray BOM or semicolon separator (the European habit) will also produce "no entries" mysteriously - check for commas.

    Third, the cache is keyed by path and lives for the session. If you edit the CSV on disk mid-session, the node keeps serving stale cached data until ComfyUI restarts. That's a feature for consistency, but it'll have you scratching your head the first time your edits don't show up. Empty CSV or missing file returns empty strings, so a typo in the path is silent - double-check the path before assuming the node is broken.

    Categorytext/prompt

    Inputs (2)

    NameTypeDefaultDescription
    csv_pathSTRING
    selected_nameCOMBO1 options: No CSV loaded

    Outputs (2)

    NameTypeDescription
    promptSTRING
    negative_promptSTRING