FL CSV Extractor
Pull one reproducible row out of a CSV by seed
- csv_data
- extracted_text
- selected_row
- full_row_data
Say you've got a spreadsheet of captions, prompts, or metadata and want your workflow to grab one entry per run - reproducibly, so the same seed always gives the same row, but different seeds sample around the file. That's FL_CSVExtractor: seed-based, modulo-indexed row selection, plus a choice of which column's value actually comes out as usable text.
How it works
It doesn't load a file itself - that's FL_LoadCSV's job elsewhere in this pack, which reads a .csv off disk and hands over raw bytes plus a row count as a CSV-typed output. FL_CSVExtractor takes that csv_data, picks a row using seed % row_count (so any seed value, however large, always lands on a valid row - this is the same modulo trick this pack's FL_ImageRandomizer and FL_NFTGenerator use elsewhere for deterministic-but-varied selection), and returns the value from whichever column_index you asked for, plus the full row for reference.
The inputs and outputs that matter
Required: csv_data - the CSV type from FL_LoadCSV, not a raw file path, so you can't skip the loader node; seed (0–999999, default 666666 - the same seed always picks the same row for a given file); column_index (0–1000, default 0 - 0 is the first column).
Optional: skip_header (default true - treats row 0 as a header and excludes it from selection; turn this off if your CSV genuinely has no header row, or you'll silently lose access to what would otherwise be a valid data row and shift the effective row count by one).
Outputs: extracted_text (the single value from your chosen column - what you'd actually wire into a prompt or caption field), selected_row (INT, which row index got picked - useful for logging which row produced a given output), full_row_data (STRING - the entire row, all columns, if you need more than just the one field you extracted).
How to install it
ComfyUI Manager: search ComfyUI_Fill-Nodes, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
then restart. This pair of nodes needs nothing beyond Python's standard CSV handling - no extra dependencies, no downloads.
Common issues & troubleshooting
"Wrong" column comes out. column_index is 0-indexed like everything else in Python: column 3 in your spreadsheet software (which counts from 1) is column_index: 2 here.
Same seed, different result after editing the CSV. Row selection is seed % row_count - add or remove rows and every seed's selection shifts, because the row count used in the modulo changed. Not a bug, but it does mean a seed you liked for one version of the file won't necessarily point at the same row after the file is edited.
Getting the header row as data, or silently losing the first real row. That's skip_header mismatched against whether your actual CSV file has a header line - check it matches. Wrong, and you either extract literal column-name text as if it were data, or drop what should be a valid first data row without any error to warn you.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| csv_data | CSV | — | |
| seed | INT | 6666660–999999 | — |
| column_index | INT | 00–1000 | — |
| skip_headeropt | BOOLEAN | true | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| extracted_text | STRING | — |
| selected_row | INT | — |
| full_row_data | STRING | — |