写入表格数据🐠meeeyo.com
Write your workflow's output back into an .xlsx, row by row
- any
- STRING
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-3or a single4; where your data starts and stops vertically. - col_range -
1-4or a single2; the horizontal range. - data - the multiline payload. Each line is a row; each
|-separated piece is a cell. Socat|dogon line 1 writescatanddoginto 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
- It won't create the file. No file = error string, no auto-create. Make the
.xlsxin Excel first, or this does nothing useful. - 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. - The
|cell separator means your data can't contain pipes - a cell witha|bwould split into two cells. - Blank cells are skipped - empty pieces in a line aren't written, so you can't use empty to clear a cell.
- 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.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| excel_path | STRING | path/to/your/file.xlsx | — |
| sheet_name | STRING | Sheet1 | — |
| row_range | STRING | 2-3 | — |
| col_range | STRING | 1-4 | — |
| data | STRING | — | |
| anyopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |