Ask AI
Skip to main content

Create csv file

Function: Create CSV File

This action generates a CSV (Comma Separated Values) file from a list of data records you provide. It allows you to define the structure of the CSV using a Dataformat, choose a character to separate values (delimiter), and decide whether to include a header row at the top of the file.

Input

  • Dataformat
    • Description: Select the data format that defines the structure of the data records you want to export. This helps the system understand how to map your data to CSV columns.
    • Type: DATA_FORMAT
    • Required: Yes
  • Delimiter
    • Description: Specify the character that will separate values in your CSV file. Common delimiters include a semicolon (;) or a comma (,).
    • Type: STRING
    • Default Value: ';'
    • Required: Yes
  • Enable Header
    • Description: Choose whether to include a header row at the very top of your CSV file. This row typically contains the names of your columns.
    • Type: BOOLEAN
    • Default Value: true
    • Required: Yes
  • Use firstrow
    • Description: If enabled, the action will automatically use the keys (names) from the first data record in your list to create the column headers. If disabled, the column headers will be determined by the selected Dataformat.
    • Type: BOOLEAN
    • Default Value: false
    • Required: No
  • Rows
    • Description: Provide the list of data records (objects) that you want to convert into rows in the CSV file. Each record will become one row.
    • Type: ARRAY
    • Required: Yes
  • File Name
    • Description: Enter the desired name for the CSV file that will be created. This name will also be used to identify the file in your application's data.
    • Type: STRING
    • Required: Yes

Output

  • File
    • Description: The newly generated CSV file. It will be stored in your application's data under the name you specified in the "File Name" input.
    • Type: FILE

Execution Flow

Real-Life Examples

Example 1: Exporting Customer List with Semicolon Delimiter and Header

You want to export a list of your customers to a CSV file for a marketing campaign. You need a header row and prefer semicolons to separate the data.

  • Inputs:
    • Dataformat: Customer_Profile (a data format defining fields like CustomerID, Name, Email)
    • Delimiter: ;
    • Enable Header: True
    • Use firstrow: False
    • Rows:
      [
      \{"CustomerID": "C001", "Name": "Alice Smith", "Email": "alice@example.com"\},
      \{"CustomerID": "C002", "Name": "Bob Johnson", "Email": "bob@example.com"\}
      ]
    • File Name: Customer_Export_20231027
  • Result: A CSV file named Customer_Export_20231027 is created and stored in your application. Its content will look like:
    CustomerID;Name;Email
    C001;Alice Smith;alice@example.com
    C002;Bob Johnson;bob@example.com

Example 2: Exporting Product Inventory with Comma Delimiter and No Header

You need a quick export of your product stock levels for an internal system that doesn't require a header and uses commas as separators.

  • Inputs:
    • Dataformat: Product_Inventory (a data format defining fields like ProductID, ProductName, StockQuantity, Price)
    • Delimiter: ,
    • Enable Header: False
    • Use firstrow: False
    • Rows:
      [
      \{"ProductID": "P101", "ProductName": "Laptop", "StockQuantity": 50, "Price": 1200.00\},
      \{"ProductID": "P102", "ProductName": "Mouse", "StockQuantity": 200, "Price": 25.50\}
      ]
    • File Name: Product_Stock_Report
  • Result: A CSV file named Product_Stock_Report is created and stored in your application. Its content will look like:
    P101,Laptop,50,1200.00
    P102,Mouse,200,25.50

Example 3: Exporting Survey Responses, Using First Row for Headers

You've collected survey responses, and the exact column names might vary slightly between surveys. You want to ensure the CSV headers match the keys from your first response.

  • Inputs:
    • Dataformat: Survey_Response (a data format defining fields like RespondentID, Question1, Question2, Feedback)
    • Delimiter: ;
    • Enable Header: True
    • Use firstrow: True
    • Rows:
      [
      \{"RespondentID": "R001", "Question1": "Yes", "Question2": "No", "Feedback": "Good experience"\},
      \{"RespondentID": "R002", "Question1": "No", "Question2": "Yes", "Feedback": "Could be better"\}
      ]
    • File Name: Survey_Results_Q3
  • Result: A CSV file named Survey_Results_Q3 is created and stored in your application. Its content will look like:
    RespondentID;Question1;Question2;Feedback
    R001;Yes;No;Good experience
    R002;No;Yes;Could be better