Nodes/ComfyUI-String-Helper/🐟String List From CSV
ComfyUI Node

🐟String List From CSV

Same prompt roulette, fed from a spreadsheet instead of ten text boxes

By liuqianhonga·Created 2 years ago·Updated about a year ago· 13
🐟String List From CSV
  • string_list
  • string_list
  • strings
csv_filetemplate/string_list.csv
use_translatedfalse
filter_tags
p1_select_by_numbers
p2_select_sequentialfalse
p3_select_random_count-1
translate_outputfalse
reuse_last_resultfalse

🐟String List From CSV is the spreadsheet version of the pack's StringList node. Where that node makes you type ten strings into ten boxes, this one pulls from a CSV file - which means a hundred strings, or a thousand, cost you nothing extra in graph real estate. Same selection engine underneath, and if you already know StringList this is a straight upgrade for any serious prompt library.

The CSV format (read this, the README is wrong)

The node expects a CSV with three columns: string, zh, and tags. string is the raw text, zh is a Chinese translation of it, and tags is a comma-separated tag list. The README still talks about a translate_string column - ignore that, the code reads string / zh / tags. A template/string_list.csv ships inside the pack as a worked example: image descriptions with Chinese captions and tags like "休闲 (casual), 女孩 (girl)".

Encoding is handled for you. The node sniffs the file with chardet and handles UTF-8 plus GBK, GB2312, GB18030, and BIG5 - a genuinely nice touch if you're working with Chinese-language data that usually arrives as GBK garbage in other tools.

The inputs that matter

  • csv_file - path to the file. Default is template/string_list.csv, and here's the trap: relative paths resolve against the folder above your ComfyUI install (two levels up from custom_nodes), not the pack folder or your project. In practice, give it an absolute path and skip the guessing game.
  • use_translated - read the zh column instead of string. For a bilingual caption library, this is the feature that makes the node worth having.
  • filter_tags - comma-separated tags; only rows whose tags column contains any of them pass through. Great for slicing "portrait only" or "landscape only" out of one big file.
  • p1_select_by_numbers / p2_select_sequential / p3_select_random_count - the same priority-ordered selection engine as StringList: by-number wins, then sequential cycling, then random count (-1 = all, 0 = none).
  • reuse_last_result - this is the interesting one. Leave it true and the node keeps returning the same random pick on every run until you flip it off, grab a fresh pick, and flip it back. Perfect for "lock this prompt while I fiddle with the sampler, then reroll."

Plus translate_output (to English) and an optional string_list input that appends extra strings to whatever came out of the CSV.

Outputs

Same pair as StringList: string_list (LIST) and strings (list of STRINGs). Wire strings into your text encoder for batch prompt rotation.

Installing

ComfyUI Manager, search "ComfyUI-String-Helper", install, restart. By hand:

cd ComfyUI/custom_nodes
git clone https://github.com/liuqianhonga/ComfyUI-String-Helper.git

Dependencies are just translators and chardet - no models, no heavy installs.

Gotchas

The translation features (both directions) ride the free Bing endpoint, so they need internet and can hiccup - failures surface as literal [翻译失败] ... text in your output. The reuse_last_result state lives on the node instance in memory, so it resets when you reload the workflow. And if your CSV is missing or malformed, the node quietly returns an empty list rather than an error - a silent empty strings into your prompt encoder is a confusing way to find out.

CategoryString Helper

Inputs (9)

NameTypeDefaultDescription
csv_fileSTRINGtemplate/string_list.csv
use_translatedBOOLEANfalse
filter_tagsSTRING
p1_select_by_numbersSTRING
p2_select_sequentialBOOLEANfalse
p3_select_random_countINT-1-1–999999
translate_outputBOOLEANfalse
reuse_last_resultBOOLEANfalse
string_listoptLIST

Outputs (2)

NameTypeDescription
string_listLIST
stringsSTRING