CSV
CSV Operator
Section titled “CSV Operator”Purpose
Section titled “Purpose”The CSV Operator enables working with CSV (Comma-Separated Values) files. It provides functionality for reading CSV files, extracting headers, converting data to CSV format, and parsing CSV content into structured data.
Use Cases
Section titled “Use Cases”- Importing data from CSV files
- Exporting data to CSV format
- Analyzing CSV file structure
- Converting between CSV and structured data formats
- Processing tabular data
- Data migration between systems
- Generating reports in CSV format
Supported Operations
Section titled “Supported Operations”get-header
Section titled “get-header”Returns the CSV header of the input file, including column names and inferred data types.
Input Parameters
Section titled “Input Parameters”file
(FileDto): The CSV file to analyzedelimiter
(char): The character used to separate values (default is comma)quoteChar
(string): The character used for quoting valuesescapeChar
(string): The character used for escaping special charactersencoding
(string): The character encoding of the fileuseHeader
(boolean): Whether to use the first row as headerskipEmptyLines
(boolean): Whether to skip empty linestrimWhitespace
(boolean): Whether to trim whitespace from values
Output
Section titled “Output”Returns a Map where keys are column names and values are the inferred data types (String, Integer, Double, Boolean).
to-csv
Section titled “to-csv”Converts an input object to a CSV file. Uses object fields/elements as columns.
Input Parameters
Section titled “Input Parameters”value
(Object): The data to convert to CSV formatdelimiter
(char): The character used to separate valuesquoteChar
(string): The character used for quoting valuesescapeChar
(string): The character used for escaping special charactersencoding
(string): The character encoding to useuseHeader
(boolean): Whether to include a header row
Output
Section titled “Output”Returns a FileDto object containing information about the created CSV file, including:
id
(string): The unique identifier of the filename
(string): The file name (default is “data.csv”)contentType
(string): The content type (“text/csv”)size
(long): The file size in bytesorganizationId
(string): The organization ID associated with the file
from-csv
Section titled “from-csv”Reads a provided CSV file and converts it to structured data.
Input Parameters
Section titled “Input Parameters”file
(FileDto): The CSV file to readdelimiter
(char): The character used to separate valuesquoteChar
(string): The character used for quoting valuesescapeChar
(string): The character used for escaping special charactersencoding
(string): The character encoding of the fileuseHeader
(boolean): Whether to use the first row as headerskipEmptyLines
(boolean): Whether to skip empty linestrimWhitespace
(boolean): Whether to trim whitespace from values
Output
Section titled “Output”Returns a List of objects representing the CSV data. If useHeader
is true, each row is represented as a Map with
column names as keys. Otherwise, each row is represented as an array of values.
- When reading CSV files, the operator can infer data types for columns
- When writing CSV files, complex objects are converted to strings
- Empty lines can be automatically skipped during processing