xbhh XLSX查看器
Read your Excel files inside ComfyUI without ever opening Excel
- content
- row_count
- col_count
Somewhere between "why would you ever need this" and "I now use it every week" sits the XBHH XLSX viewer. It reads an .xlsx file, renders the sheet as a formatted text table right in the node, and hands you the content plus row and column counts as outputs. If your prompts, LoRA lists, or batch parameters live in a spreadsheet - which a surprising number of people's actually do - this lets the graph itself read them.
The classic setup: a spreadsheet where each row is a prompt variation or a character spec, you pick one (or just eyeball the sheet), and the node turns spreadsheet rows into workflow inputs. It also earns its keep as a lightweight inspection tool when you're handed a config workbook and don't want to alt-tab out of ComfyUI to read it.
How it works
It's a thin wrapper around openpyxl - the only real Python dependency in the entire XBHH kit, and this node is why it exists. On execution it loads the workbook in read-only mode, picks the requested sheet (or the first one if sheet_name is blank), reads up to max_rows rows, and formats them into an aligned pipe-separated table. It caps column width at 20 characters with a .. truncation marker so huge cells don't turn the output into a wall. Values are read with data_only=True, which means you get computed results rather than formulas.
The inputs and outputs that matter
- file_path - the full path to the
.xlsxfile. Required, and it's a path, not a dropdown - there's no file picker. - sheet_name (optional) - pick a specific sheet by name; blank means the first/active sheet.
- max_rows (optional) - cap on how many rows get read and rendered, default 100, max 10000. Raise it for big sheets, lower it for speed on enormous ones.
Three outputs: content (STRING - the whole rendered table), row_count and col_count (INTs - the true totals from the sheet, not just what you capped). Those counts are the sleeper feature: wire row_count into iteration logic or a batch-size calculator and the spreadsheet drives the workflow.
Installing it
This is the node that makes the kit's install step non-optional:
cd ComfyUI/custom_nodes
git clone https://github.com/xbhh123456/Comfyui-xbhh-main.git
cd Comfyui-xbhh-main
pip install -r requirements.txt
That requirements.txt is essentially just openpyxl>=3.1.0. Skip the pip step and this node will happily tell you exactly what's missing. ComfyUI Manager users can search xbhh-lora and Manager handles the dependency.
Common issues
- "❌ 需要安装 openpyxl 库" - you skipped the pip install, or you installed the pack into an environment where
requirements.txtnever ran.pip install openpyxlin the same environment as ComfyUI, restart, done. - "❌ 仅支持 .xlsx 格式文件" - it's
.xlsxonly. Old.xlsfiles from Excel 97–2003 are rejected; re-save them as.xlsxfirst. - "❌ 文件不存在" - the node takes a real filesystem path, not a ComfyUI-relative path. On Windows, mind that your path string might need
C:/Users/...forward slashes depending on how you pasted it. - The table view is read-only by design - this is a viewer, not an editor. If you want to modify sheets from a workflow, this isn't that node.
One honest note: this node is a specialty tool. You'll either have a spreadsheet-driven workflow and consider it essential, or never touch it. Both are fine - but if you ever find yourself hand-copying rows from Excel into a text widget, you now know the better way.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| file_path | STRING | xlsx 文件的完整路径 | |
| sheet_nameopt | STRING | 工作表名称(留空则使用第一个工作表) | |
| max_rowsopt | INT | 1001–10000 | 最大显示行数 |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| content | STRING | — |
| row_count | INT | — |
| col_count | INT | — |