Nodes/Comfyui_JTnodes/JT Save Text to Excel
ComfyUI Node

JT Save Text to Excel

Drop a value into a spreadsheet cell from inside your workflow

By Jint8888·Created about a year ago·Updated about a year ago· 1
JT Save Text to Excel
    • STRING
    text
    folder_path/path
    filenameoutput
    sheet_nameSheet1
    row1
    column1

    JT Save Text to Excel writes a string into a specific cell of an Excel file, creating the workbook and the sheet if they don't exist. It's the "data-out" counterpart to JT Read From Excel, and together they let you log generation results, prompts, or metadata straight into a spreadsheet that anyone can open in Excel, Numbers, or Google Sheets.

    Why you'd reach for it

    ComfyUI is great at producing images and mediocre at producing records. If you want a run log - prompt used, seed, result notes - you can either build it by hand or let a workflow write it. This node is the letting-it-write option: wire a text output (say, from the JT Siliconflow LLM node or any prompt text) into it, tell it where to put the value, and rerun the workflow to append your log row by row. Combined with a counter node driving the row number, you get an auto-filling spreadsheet log.

    The inputs

    • text (STRING, multiline) - what to write.
    • folder_path (STRING) - destination folder. Default /path; change it, always.
    • filename (STRING) - file name, default output. .xlsx is appended automatically if you leave it off.
    • sheet_name (STRING) - worksheet name, default Sheet1.
    • row (INT) - 1-based row, up to 1,048,576.
    • column (INT) - 1-based column, up to 16,384.

    The single output is STRING - the text that actually got written.

    How it works, and the trap to remember

    The mechanism is dead simple: load the workbook if it exists (creating it otherwise), get-or-create the named sheet, write the value to that cell, save. The node even cleans up openpyxl's default Sheet tab when it creates a differently-named sheet, which is a nice touch.

    But read this twice: if your input has multiple lines, only the first line is saved. The README states it plainly, and the code implements it - text.split('\n')[0]. So a multi-line prompt will not arrive intact in the spreadsheet; you get its first line and the rest vanishes. If you need the full text, save it to a file with JT Save Text to File instead and put a summary or reference in the cell.

    Also worth knowing: it overwrites whatever was in that cell, and it operates on a 1-based row/column, so row 1 / column 1 is A1. There's no "insert row" behavior - you pick the destination, so a logging loop has to drive the row number yourself (a counter works great).

    Gotchas

    • The /path default will happily create a folder called path at your filesystem root. Set a real one.
    • Only the first line survives. Seriously, this is the one that'll trip you.
    • Opening the file in Excel while ComfyUI is mid-run can fail on Windows (file lock). Close the spreadsheet before rerunning.

    Installing it

    Same pack, same drill - Comfyui_JTnodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Jint8888/Comfyui_JTnodes
    pip install "openai>=1.0.0" "openpyxl>=3.0.0"
    

    or "Comfyui_JTnodes" in ComfyUI Manager. openpyxl is required for every Excel node in the pack, and because the repo has no requirements.txt, you install it manually - otherwise the pack fails to import at startup and all JT nodes vanish. Restart ComfyUI and look under JT > JT/text.

    The README is in Chinese, but the code is about forty readable lines. For turning scattered generation results into an actual spreadsheet you can hand to someone, this is a small, honest tool - just remember it's a cell writer, not a CSV appender.

    CategoryJT/text

    Inputs (6)

    NameTypeDefaultDescription
    textSTRING
    folder_pathSTRING/path
    filenameSTRINGoutput
    sheet_nameSTRINGSheet1
    rowINT11–1048576
    columnINT11–16384

    Outputs (1)

    NameTypeDescription
    STRINGSTRING