ComfyUI Custom Node: CSV Search Node
This repository contains a custom node for ComfyUI that allows searching for a keyword in the first column of a CSV file and returning a value from a specified column in that row. The node is designed to be modular and fit within the node-based workflow of ComfyUI.
Features
- CSV Search: The node searches for a keyword in the first column of a CSV file (delimited by
;
). - Column Value Return: Once the keyword is found, the node returns the value from the column specified by the user.
- Modular Node: Can be integrated into any ComfyUI workflow.
Node Inputs
- file_path (STRING): Path to the CSV file.
- keyword (STRING): The keyword to search for in the first column of the CSV file.
- column_number (INT): The column index (0-indexed) from which to return the value if the keyword is found.
Node Output
- Output String: The value from the specified column, or an error message if the keyword or column is not found.
Usage Example
- Place the CSV file in a known directory.
- Use the custom node in ComfyUI, inputting:
- The full file path to the CSV.
- The keyword to search for in the first column.
- The column index to retrieve data from (e.g., 2 for the 3rd column).
- The node will return the matching value from the row or an error message if something is incorrect.
Example CSV
ID;Name;Age;Department
1;Alice;30;Engineering
2;Bob;25;Marketing
3;Charlie;35;HR
4;David;28;Engineering
5;Eva;40;Finance
If you search for Alice
in the first column and ask for column index 3
(Department), the node will return "Engineering"
.
Installation
- Download the
search_csv_node.py
file. - Place the file in the
custom_nodes
directory of your ComfyUI installation. - Restart ComfyUI, and the node should appear under the "Util" category.
License
This project is licensed under the MIT License.