Nodes/ComfyUI-HappNodeSet/CSV Value Extractor
ComfyUI Node

CSV Value Extractor

Grab one value out of a comma-separated string — both as a float and as text

By mikemojen·Created 8 months ago·Updated 3 months ago· 0
CSV Value Extractor
    • value_float
    • value_string
    csv_string
    index0

    Somewhere in your workflow, a node hands you a string like 824.00, 823.00, 446.00, 446.00 and you need one of those numbers as a real float. That's the exact job of CSV Value Extractor: it splits a comma-separated string by index and returns the value twice - once as a FLOAT, once as a STRING - so you can do math with one copy and display the other. The placeholder in the input box is literally the example above, which tells you this node was built for a real workflow that output lists of measurements.

    How it works

    It splits csv_string on commas, strips whitespace, drops empty entries, and picks the element at index (0-based, default 0). It then converts that element to a float and returns both forms. The error handling is friendly: empty input, out-of-range index, or a non-numeric value all return (0.0, "0") instead of crashing - which means you can wire it in and not worry about one bad row killing the graph.

    The index is an INT (0–1000, default 0), so you could, in principle, parameterize it with another node if you're extracting values in a loop. Most of the time you'll just type the index of the field you want and move on.

    What comes out

    • value_float (FLOAT) - the numeric value, for math nodes, comparisons, or dimension chains.
    • value_string (STRING) - the original text as it appeared, for display.

    One subtle thing: the string output is the original text, not a re-serialization of the float. If the source was 446.00, you get "446.00" back, keeping the formatting. That's actually what you want when the string feeds a report.

    Where it fits

    The most natural source is a measurement node that exports comma-separated lists - this pack's own LineDetector outputs line_lengths as a comma-separated string, so CSV Value Extractor is the obvious way to pull line #3's length out as a number and do something with it (compare, threshold, feed a dimension calc). It also slots in after any LLM or text node that returns CSV-ish output. If a downstream node wants a single clean number and you have a list, this is the adapter.

    Install

    Part of ComfyUI-HappNodeSet (mikemojen). ComfyUI Manager: search HappNodeSet. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/mikemojen/ComfyUI-HappNodeSet.git
    pip install -r ComfyUI-HappNodeSet/requirements.txt
    

    Restart ComfyUI. Pure Python string handling - no dependency weight at all.

    Common issues

    Index out of bounds silently returns 0, which is fine for a fallback but easy to misread as "the value is zero" when the string was actually shorter than you thought. Watch for mixed decimal separators too: if the string uses semicolons or tabs instead of commas, this node won't split it - run a string-replace first. And leading/trailing whitespace and empty slots are handled, so "1, , 3" at index 2 gives you "3", not a crash. It's a small, sharp tool; treat it as one.

    Categoryutils

    Inputs (2)

    NameTypeDefaultDescription
    csv_stringSTRING
    indexINT00–1000

    Outputs (2)

    NameTypeDescription
    value_floatFLOAT
    value_stringSTRING