A ComfyUI custom node that provides dynamic text substitution using wildcards and CSV files. Perfect for creating varied prompts with consistent relationships between terms.
A ComfyUI custom node that provides dynamic text substitution using wildcards and CSV files. Perfect for creating varied prompts with consistent relationships between terms.
git clone https://github.com/illuminatianon/comfyui-csvwildcards.git
The node system provides two main ways to substitute text:
{filename}
or {directory/filename}
{csv:filename:column}
or {csv:directory/filename:column}
You can organize your wildcard files in the data
directory using subdirectories of any depth:
data/
# Direct files in root
animal.txt # Simple wildcard file
monster.txt # CSV wildcard file (can coexist with .txt)
monster.csv
monster/
types.txt
abilities.txt
pokemon/
gen1/
types.txt
moves.csv
abilities.csv
gen2/
types.txt
moves.csv
Key points about directory structure:
{name}
will use name.txt
for simple wildcards{csv:name:column}
will use name.csv
for CSV wildcards{name/file}
will look in the name/
directoryThe {monster} saw a {csv:monster:color} creature in {monster/types}
/
) for subdirectories, even on WindowsSimple wildcards use text files where each line is a possible value. For example, animal.txt
:
wolf
dragon
bear
tiger
Use these in your templates:
A {animal} with {texture} fur # Direct file reference
A {monster} with {monster/abilities} # File and directory reference
A {pokemon/gen1/types} Pokemon # Deep path reference
CSV wildcards maintain relationships between related terms using CSV files with headers. Example monster.csv
:
color,size,texture
red,large,scaly
blue,small,furry
green,medium,slimy
purple,tiny,rough
Use these in your templates:
The {csv:monster:color} creature was {csv:monster:size} # Direct file reference
A Pokemon with {csv:pokemon/gen1/moves:name} that causes {csv:pokemon/gen1/moves:effect} # Deep path reference
Important: All references to the same CSV file in a single prompt will use values from the same row, maintaining consistency in your descriptions.
CSVWildcardNode
to your workflowBasic wildcards:
A {animal} with {texture} skin and {appendage} appendages
CSV with relationships:
The {csv:monster:color} {animal}-like monster has {csv:monster:size} {appendage} with a {csv:monster:texture} texture
Mixed directory usage:
A {pokemon/gen1/types} Pokemon that knows {csv:pokemon/gen1/moves:name} which has {csv:pokemon/gen1/moves:power} power
/
) for paths, even on Windows{folder/subfolder/file}
)