Nodes/ComfyUI-SubjectStyle-CSV/CSV Prompt Processor
ComfyUI Node

CSV Prompt Processor

The CSV Prompt Processor

By maracman·Created 2 years ago·Updated 5 months ago· 3
CSV Prompt Processor
    • positive_prompt
    • negative_prompt
    style
    subject
    log_prompttrue
    text_positive
    text_negative

    Ever had a grid of prompts you kept meaning to organize - every subject you shoot, in every style you shoot it in, with the negatives that go with each? That's the whole job of the CSV Prompt Processor. It reads a CSV of prompts where each row is a subject and each column is a style, hands you two dropdowns, and spits out the positive and negative prompt for whatever combination you pick. No API calls, no model downloads, no hype - it's a tiny organizational node that keeps your prompt matrix out of the graph and in a spreadsheet where you can actually edit it.

    It's from a small, one-node pack (ComfyUI-SubjectStyle-CSV) built around an SDXL food-photography workflow. The author's example is the classic use case: the same chicken breast raw, cooked, and plated as a meal, with a negative column (cooked, sides, wooden table) so the raw shot doesn't drift. The style/subject grid pattern generalizes to product catalogs, character sheets, or any "N subjects × M styles" shoot where the prompt combinations are known up front.

    How it works

    The node loads prompts_csv.csv from the csv_input/ folder inside its own custom node directory on every refresh, using pandas. The first column is the subject; every other column is a style; any column whose name starts with _ is the negative prompt for the style to its left. So a header row like ,Raw,_Raw,Cooked,_Cooked means: style "Raw" with negative "cooked", style "Cooked" with negative "sides, garnish, sauce".

    The dropdowns are built dynamically from that file, enumerated so they read like 1. Raw, 2. Cooked, 1. chicken breast, 2. whole chicken. Pick one of each and the node concatenates the matching cell with your extra text, and returns two STRING outputs: positive_prompt and negative_prompt. Those wire straight into a couple of CLIPTextEncode nodes feeding your sampler. Whatever you type in text_positive gets appended to the chosen prompt; text_negative does the same for the negative side - handy for adding a per-generation tweak without touching the CSV.

    The inputs that matter

    Only three are worth your attention:

    • style - dropdown of your CSV's columns.
    • subject - dropdown of your CSV's rows.
    • text_positive / text_negative - extra text appended to the chosen prompts. Leave them empty if your CSV already says everything.
    • log_prompt defaults to on, which just prints the composed prompts to your ComfyUI console. Turn it off when the spam gets old.

    Installing it

    The easy way is ComfyUI Manager - search ComfyUI-SubjectStyle-CSV and install. Or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/maracman/ComfyUI-SubjectStyle-CSV
    

    Then restart ComfyUI. There are no model files to fetch. One quiet dependency: the pack uses pandas but ships no requirements.txt, so if your ComfyUI Python env doesn't already have it you'll get ModuleNotFoundError: No module named 'pandas'. Fix it with pip install pandas.

    Where it bites

    Two real gotchas, one of which is the README's fault. The README tells you to name the file prompt_csv.csv - the actual code reads prompts_csv.csv (with an "s"). Follow the code, not the doc, and copy the template (prompts_csv_template.csv) as your starting point.

    Second: the dropdown values come from the CSV at load time and are matched by name. If you edit or replace the CSV and then run a workflow that still has old dropdown selections saved, nothing matches and the node dies with an UnboundLocalError. Keep subject names unique, and re-select the dropdown values after changing the file.

    Honestly, this node is a niche thing. If you're not running a subject×style grid, ComfyUI's built-in prompt nodes or a prompt-scheduler utility do more. But for that one specific spreadsheet-shaped workflow, it's dead simple and it works - just mind the filename.

    CategoryCSV Processing

    Inputs (5)

    NameTypeDefaultDescription
    styleCOMBO4 options: 1. Raw, 2. Cooked, 3. Meal, 4. non-food
    subjectCOMBO5 options: 1. chicken breast, 2. whole chicken, 3. T-Bone, 4. fillet mingon, 5. Salmon
    log_promptBOOLEANtrue
    text_positiveSTRING
    text_negativeSTRING

    Outputs (2)

    NameTypeDescription
    positive_promptSTRING
    negative_promptSTRING