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

🐟String List To CSV

The write side of the pack's bilingual prompt library

By liuqianhonga·Created 2 years ago·Updated about a year ago· 13
🐟String List To CSV
  • string_list
  • processed_strings
  • skipped_strings
csv_fileoutput/string_list_output.csv
tags
translatefalse
append_modetrue
string

🐟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 tags column. This is how you keep your library filterable later.
  • translate - set true and each string is auto-translated to Chinese via the free Bing translator, filling the zh column. Turn it off and zh stays empty.
  • append_mode - default true. New runs append instead of overwriting, and existing string values 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.

CategoryString Helper

Inputs (6)

NameTypeDefaultDescription
csv_fileSTRINGoutput/string_list_output.csv
tagsSTRING
translateBOOLEANfalse
append_modeBOOLEANtrue
stringoptSTRING
string_listoptLIST

Outputs (2)

NameTypeDescription
processed_stringsLIST
skipped_stringsLIST