Nodes/ComfyUI_StringOps/写入表格数据🐠meeeyo.com
ComfyUI Node

写入表格数据🐠meeeyo.com

Write your workflow's output back into an .xlsx, row by row

By MeeeyoAI·Created 2 years ago·Updated about a year ago· 209
写入表格数据🐠meeeyo.com
  • any
  • STRING
excel_pathpath/to/your/file.xlsx
sheet_nameSheet1
row_range2-3
col_range1-4
data

ReadExcelData gets your spreadsheet into ComfyUI; WriteExcelData is the way back out. It takes a block of data - lines of pipe-separated values, the same format the reader produces - and writes it into a specific range of an existing .xlsx, then saves the file. If you're logging generation results, filling a product sheet from a batch, or updating a prompt table from inside a workflow, this is your writer.

It's part of ComfyUI_StringOps, the same small utility pack that ships the reader. Together they're a working spreadsheet bridge - which is rare enough among custom node packs that it's the pack's most distinctive feature.

How it works

Five inputs:

  • excel_path - absolute path to an existing file. The file must already exist - this node refuses to create one from scratch, and will hand you back Error: File does not exist at path: ....
  • sheet_name - the tab to write into, default Sheet1.
  • row_range - 2-3 or a single 4; where your data starts and stops vertically.
  • col_range - 1-4 or a single 2; the horizontal range.
  • data - the multiline payload. Each line is a row; each |-separated piece is a cell. So cat|dog on line 1 writes cat and dog into the first two cells of the start row.

It loads the workbook with openpyxl (in read-write mode, data_only=True), clamps ranges to start at 1, writes, saves, and closes. Output is a single STRING - Data written successfully! on success, or an Error: ... message.

The traps - and there are real ones

  1. It won't create the file. No file = error string, no auto-create. Make the .xlsx in Excel first, or this does nothing useful.
  2. Write permission is checked - if the file is read-only or locked (say, open in Excel), you get a Permission Error. Close the file in Excel before running the queue.
  3. The | cell separator means your data can't contain pipes - a cell with a|b would split into two cells.
  4. Blank cells are skipped - empty pieces in a line aren't written, so you can't use empty to clear a cell.
  5. Errors return as strings on a STRING output - which is fine here (unlike the pack's INT-output nodes), but check the output before trusting the write.

Where you'd use it

The classic loop: run a batch, collect each result (filename, seed, prompt), format lines as filename|seed|prompt, and append into a log sheet. It also closes the automation circle with the reader - read a config range, generate, write results back to a results range in the same workbook. Since this pack never caches, the write re-runs every queue, which is exactly what you want for a live log.

Installing it

Pack standard: ComfyUI Manager → ComfyUI_StringOps, or

cd ComfyUI/custom_nodes
git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git

Restart. openpyxl (its one nonstandard dependency) comes from the pack's requirements.txt, which Manager installs. No models.

The honest take

For the niche of "ComfyUI writes to Excel," this is a working, no-nonsense tool - once you get past the must-exist file and the pipe separator. It's not a fancy table editor and it can't create or format a workbook, so do your structure in Excel and let this only fill cells. If that's your pipeline, reader + writer + NumberExtractor is a complete data loop in one pack.

CategoryMeeeyo/File

Inputs (6)

NameTypeDefaultDescription
excel_pathSTRINGpath/to/your/file.xlsx
sheet_nameSTRINGSheet1
row_rangeSTRING2-3
col_rangeSTRING1-4
dataSTRING
anyopt*

Outputs (1)

NameTypeDescription
STRINGSTRING