读取表格数量差🐠meeeyo.com
How many filled cells are in that row? This node counts and diffs them
- any
- INT
Sometimes the number you need isn't in the spreadsheet - it's about the spreadsheet. How many items are in this row? Are two rows the same length? ReadExcelRowOrColumnDiff answers exactly that: it counts the filled cells in a row (or column), optionally compares two of them, and returns the difference as a plain INT.
The Chinese display name is 读取表格数量差, "read the table quantity difference," which is the honest description. It's part of ComfyUI_StringOps, the utility pack that treats Excel as a first-class data source, and it's the arithmetic companion to ReadExcelData - that one gives you the contents, this one gives you the lengths.
How it works
Four inputs:
- excel_path - absolute path to the
.xlsx. - sheet_name - the tab, default
Sheet1. - read_mode -
读行(read row) or读列(read column). These are the actual UI labels; in practice: rows or columns. - indices - one or two numbers, comma-separated.
1,3compares index 1 with index 3; a single2just counts index 2.
For each index it walks the row or column counting filled cells - and here's the subtle part - it stops at the first empty cell. It's not counting non-empty cells across the whole row; it's measuring a contiguous block. If row 1 is A, B, C, (empty), D, you get a count of 3, not 4. For clean tables (the kind you'd batch-run), that's fine and even desirable; for ragged data it will quietly undercount.
Output is a single INT: the count if you gave one index, or count1 - count2 if you gave two. Use it to drive a comparison node or a conditional - "these two batches don't match, stop."
Where it fits
The realistic use is validation in a batch pipeline. Say you generate one image per product row and one per reference row; wire this node in front of a "if not equal, halt" check so you notice drift before you burn an hour on mismatched batches. It also works as a crude "how long is this list" sensor feeding an integer-based loop or a batch-size calculation.
Like the rest of the pack, errors come back as strings (Error: ...), but here's the trap: this node's output type is INT. If something fails, you get Error: File does not exist at path: ... as a string on an INT port, which will break anything that consumes it. So validate the path up front - the node itself checks existence and read permission and complains helpfully, but you'll see that complaint as an error string, not a number.
Installing it
Standard for the pack: ComfyUI Manager → ComfyUI_StringOps, or
cd ComfyUI/custom_nodes
git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git
Restart. openpyxl comes from requirements.txt; no models to fetch.
The honest take
This is a narrow node for a specific job - counting contiguous filled cells and diffing two of them. If your sheets are tidy, it's a one-node answer to "did my data get truncated?" If your sheets are messy, the stop-at-first-empty behavior will surprise you, and you might be better off reading the data with ReadExcelData and counting with a string node instead. It's a useful sentry, not a general-purpose Excel tool.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| excel_path | STRING | path/to/your/file.xlsx | — |
| sheet_name | STRING | Sheet1 | — |
| read_mode | COMBO | 读行 | 2 options: 读行, 读列 |
| indices | STRING | 1,3 | — |
| anyopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |