🐟String List To CSV
The write side of the pack's bilingual prompt library
- string_list
- processed_strings
- skipped_strings
🐟String List To CSV is the other half of the pack's persistence story. StringListFromCSV samples prompts from a CSV; this node writes them to one. Run it after a generation, dump the winning prompt (or the whole batch) into a file, tag it, and next week StringListFromCSV can sample from what you saved. It's the "keep the good stuff" node - boring until you've lost a prompt you liked, then it's a small miracle.
What it does
Two optional inputs, string (a single value) and string_list (a LIST). If you provide both, they're merged. Each string becomes a row in a CSV with columns string, zh, tags - the same format the pack's reader expects, so it round-trips cleanly. There's no hand-editing needed; the writer and reader are built to agree.
The inputs that shape the write:
- csv_file - where it goes. Default
output/string_list_output.csv. Relative paths resolve against the folder above your ComfyUI install, so an absolute path is the safer bet. - tags - a comma-separated tag string written to every row's
tagscolumn. This is how you keep your library filterable later. - translate - set
trueand each string is auto-translated to Chinese via the free Bing translator, filling thezhcolumn. Turn it off andzhstays empty. - append_mode - default
true. New runs append instead of overwriting, and existingstringvalues are detected and skipped rather than duplicated.
Outputs
Two of them, both LISTs: processed_strings (the rows actually written) and skipped_strings (the duplicates rejected in append mode). It's an output node, so nothing here feeds the image pipeline - you're auditing a file write. If both inputs are empty, you get empty lists back, which is its way of saying "nothing to do."
The translator caveat
The translate feature is the pack's one dependency doing real work: Bing through the translators library, free, needs internet, occasionally rate-limited or flaky. On failure you get a [翻译失败] ... string sitting in your zh column - which is worse than an empty cell, because it's plausible-looking garbage. If you're building a clean library, either run translation when you know you're online and spot-check, or do the translation elsewhere. For English-only caption storage, leave it off entirely.
Installing
ComfyUI Manager, search "ComfyUI-String-Helper", install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/liuqianhonga/ComfyUI-String-Helper.git
Dependencies are translators and chardet (the latter sniffs the file's encoding on read, handling UTF-8 and GBK/GB2312/GB18030/BIG5 - welcome news if your prompt library is in Chinese).
The workflow it enables
Generation → pick a keeper → StringListToCSV with tags → later, StringListFromCSV samples it back out. The JsonToCSV node is the variant for when your data arrives as structured JSON (say, from an LLM captioner) instead of plain strings. Together they turn a folder of random outputs into a queryable, bilingual prompt corpus - which is a surprisingly rare thing to get in ComfyUI without writing your own file-handling nodes.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| csv_file | STRING | output/string_list_output.csv | — |
| tags | STRING | — | |
| translate | BOOLEAN | false | — |
| append_mode | BOOLEAN | true | — |
| stringopt | STRING | — | |
| string_listopt | LIST | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| processed_strings | LIST | — |
| skipped_strings | LIST | — |