Skip to content

Data to CSV

Create a CSV file from a list of data objects.
The component takes a set of data records, turns them into a CSV string, and can also write that string to a file in the working directory.

How it Works

The component collects all the keys from the input data objects and sorts them to form the column headers.
It then writes each data record as a row, using the chosen field separator (default ,) and row separator (default \n).
If Quoting is enabled, any field that contains special characters is wrapped in quotes so the CSV remains valid.
The resulting CSV text is returned as a Message, and a Data object containing the file content is also produced, ready to be saved or passed to other components.

Inputs

  • File Content: The list of data objects that will become the rows of the CSV file.
  • Field Separator: The character used to separate columns in the CSV (e.g., ,, ;, |).
  • File Name: The name of the file that will be created (default is data.csv).
  • Quoting: If checked, fields that contain special characters will be surrounded by quotes.
  • Row Separator: The character(s) used to separate rows (default is a newline \n).

Outputs

  • File Data: A Data object that contains the CSV file content, ready to be stored or forwarded.
  • CSV Text: A plain text Message that shows the CSV string, useful for previewing or logging.

Usage Example

  1. Prepare data – Create a list of Data objects, each with the same set of keys (e.g., name, age, email).
  2. Configure the component
    • Set File Name to contacts.csv.
    • Leave Field Separator as ,.
    • Enable Quoting if any email addresses contain commas.
    • Keep Row Separator as the default \n.
  3. Run the workflow – The component outputs the CSV text and a file data object.
  4. Save or use the file – Connect the File Data output to a file‑saving component or to downstream processes that need the CSV.
  • DataReader – Read data from CSV or other formats into Data objects.
  • DataProcessor – Transform or filter Data objects before writing them to CSV.
  • FileSaver – Persist a Data object to disk or cloud storage.

Tips and Best Practices

  • Use a unique File Name for each run to avoid overwriting existing files.
  • If your data contains commas, semicolons, or newlines, enable Quoting to keep the CSV valid.
  • For large datasets, consider streaming the output to avoid memory issues.
  • Verify that the Field Separator matches the expectations of any system that will consume the CSV.

Security Considerations

  • The component writes files only to the local working directory; no external services are called.
  • Ensure that sensitive data is handled according to your organization’s data‑handling policies before writing it to disk.
  • If the CSV will be shared, double‑check that no confidential information is inadvertently included.