CSV to Data List
The CSV to Data List component lets you take a CSV file, a path to a CSV file, or a raw CSV string and turn it into a list of Data objects that can be used in other parts of your Nappai workflow. It’s a quick way to bring tabular data into the system without writing any code.
How it Works
When you provide one of the three inputs, the component reads the CSV content and uses the pandas library to parse it into a table. Each row of the table is then converted into a Data
object, which is a simple key‑value container that Nappai can pass around. The result is a list of these Data
objects that you can feed into other components.
The component checks that exactly one input is supplied. If you give more than one or none, it will raise an error. It also verifies that the file you upload or the path you provide ends with .csv
. The CSV is read using UTF‑8 encoding, so make sure your file is encoded that way to avoid parsing errors.
Inputs
-
CSV File: Upload a CSV file to convert to a list of Data objects
Upload a CSV file to convert to a list of Data objects -
CSV File Path: Provide the path to the CSV file as pure text
Provide the path to the CSV file as pure text -
CSV String: Paste a CSV string directly to convert to a list of Data objects
Paste a CSV string directly to convert to a list of Data objects
Outputs
- Data List: A list of
Data
objects created from each row of the CSV.
This output can be connected to any component that accepts a list ofData
, such as filters, transformers, or storage components.
Usage Example
-
Upload a CSV file
Drag the component onto your canvas, click the CSV File field, and selectcustomers.csv
.
The component will read the file and output a list ofData
objects, each representing a customer row. -
Paste a CSV string
If you have a small table, you can paste it directly.name,age,emailAlice,30,alice@example.comBob,25,bob@example.comCopy the text, paste it into the CSV String field, and run the workflow. The component will produce the same list of
Data
objects.
You can then connect the Data List output to a component that, for example, filters customers by age or sends a welcome email.
Related Components
- Data to CSV – Convert a list of
Data
objects back into a CSV file. - Filter Data – Keep only the rows that meet certain conditions.
- Store Data – Save the list of
Data
objects to a database or file.
Tips and Best Practices
- Header Row: Make sure your CSV includes a header row; the component uses it to create keys for each
Data
object. - Encoding: Use UTF‑8 encoding for your CSV files to avoid parsing errors.
- File Size: Very large CSV files may slow down the workflow; consider splitting them or processing in batches.
- Validation: If you’re unsure about the CSV format, test with a small sample first.
Security Considerations
The component processes the CSV locally on the Nappai server; it does not send data to external services. However, be cautious when uploading files from untrusted sources, as malformed CSV can sometimes trigger parsing errors or consume excessive resources. Always validate or sanitize input files when possible.