Nodes/ComfyUI-LZNodes/LZ Save String to CSV
ComfyUI Node

LZ Save String to CSV

Log a row of parameters to a spreadsheet

By liz-ils·Created 7 months ago·Updated 12 days ago· 1
LZ Save String to CSV
    • output_path
    filepathoutput.csv
    mode
    header
    row_data

    People who track generations seriously end up keeping spreadsheets: run date, seed, model, cfg, the prompt that worked. LZ Save String to CSV is the node that automates the writing part. Give it a CSV path, a mode, an optional header, and a row of comma-separated values, and it appends (or creates) the file for you. It returns the absolute path it wrote to, so downstream nodes know where the row landed.

    It's the plainer sibling of the pack's LZAppendLogToCSV, which exists specifically to grab generation parameters out of a pipe. This one takes a raw string and writes it - you control exactly what goes in the row, which makes it a general-purpose CSV writer rather than a metadata-aware one. If you already have a prompt, seed, and settings sitting in string nodes, you can assemble a row by hand with a StringConcatNode and hand it over.

    The inputs

    • filepath - where to write. Default output.csv.
    • mode - write or append. Write creates/overwrites the file and writes the header; append reads the existing file (if any) and re-writes it with the new row tacked on.
    • header - comma-separated column names, written once when the file is created.
    • row_data - comma-separated values for one row.
    • Output: output_path - the absolute path of the file (also marks this as an output node, so the graph runs to it).

    Because it's an output node, it doubles as a checkpoint that forces the string chain before it to actually execute - handy when you want to guarantee a row gets written every run.

    Gotchas worth knowing

    Relative paths resolve against ComfyUI's working directory, which is wherever you launched ComfyUI from - often the ComfyUI root, but not guaranteed if you're on a desktop shortcut or a script. If the file isn't landing where you expect, use an absolute path like C:\Users\you\generations\sweeps.csv or /home/you/generations/sweeps.csv. The node does no path sanitation beyond stripping whitespace.

    Append is read-modify-write, not a true append. It loads the whole existing file, adds your row, and rewrites everything. Fine for a single node writing a log; a bad idea if two runs write to the same file concurrently. Keep one writer per CSV and you'll never notice.

    It splits on commas. Both the header and row data are split on ,, so a value containing a comma (a prompt with commas, say) will be shredded into separate cells. If your row is prompt text, this node is the wrong tool - the pack's LZAppendLogToCSV handles pipe values more sensibly for that job. Use this one for clean, comma-free fields.

    Installing it

    Standard pack install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/liz-ils/ComfyUI-LZNodes
    

    Restart ComfyUI, or ComfyUI Manager → search "ComfyUI-LZNodes". No dependencies beyond stock ComfyUI, no model files. Then open the CSV in any spreadsheet program and you've got a generation log you can sort, filter, and chart without ever leaving your workflow.

    CategoryMyCustomNodes/Text

    Inputs (4)

    NameTypeDefaultDescription
    filepathSTRINGoutput.csv
    modeCOMBO2 options: write, append
    headerSTRING
    row_dataSTRING

    Outputs (1)

    NameTypeDescription
    output_pathSTRING