Operations (sample payloads)

Main operations

Add Column

Add a new column to the CSV. Sample Input Sample Output

Add Row

Add a new row to the end of the CSV Sample Input Sample Output

Add Rows

Add multiple rows to the end of the CSV Sample Input Sample Output

{
    "rows_inserted": 3,
    "rows_not_inserted": 0,
    "error_rows": \{
        "message": "",
        "errorRows": []
    \}
}

Create CSV

Create a temporary CSV for use within the current workflow execution. You can perform operations on this CSV within a single workflow execution, but will need to export the CSV at the end otherwise it will be deleted. Sample Input

{
    "scope": "current_run",
    "number_of_columns": 5,
    "columns": [
        \{
            "name": "Name",
            "type": "text"
        \},
        \{
            "name": "Age",
            "type": "number"
        \},
        \{
            "name": "Salary",
            "type": "large_number"
        \},
        \{
            "name": "Performance Score",
            "type": "double",
            "format": "0.00"
        \},
        \{
            "name": "Hire Date",
            "type": "date",
            "format": "YYYY-MM-DD"
        \}
    ],
    "number_of_rows": 3,
    "use_utf8": false
}

Sample Output

Create CSV From File

Create a temporary CSV for use within the current workflow execution from an existing file. You can perform operations on this CSV within a single workflow execution, but will need to export the CSV at the end otherwise it will be deleted. Sample Input

{
    "file_url": "https://example.com/sales_data.csv",
    "delimiter": "comma",
    "has_header": true,
    "scope": "current_run",
    "escape_char": "\\",
    "enclose_char": "\"",
    "end_line": "auto_detect",
    "validate_csv_settings": true,
    "default_text_type": {
        "length_limit": 100
    },
    "column_types": [
        \{
            "name": "Date",
            "type": "date",
            "format": "YYYY-MM-DD"
        \},
        \{
            "name": "Revenue",
            "type": "number",
            "format": "0,0.00"
        \}
    ],
    "column_indices": [
        \{
            "column_names": [
                "Date",
                "Product"
            ]
        \}
    ],
    "whitelisted_columns": [
        "Date",
        "Product",
        "Revenue",
        "Quantity"
    ]
}

Sample Output

Create CSV From XLSX File

Create a temporary CSV for use within the current workflow execution from an existing XLSX file. You can perform operations on this CSV within a single workflow execution, but will need to export the CSV at the end otherwise it will be deleted. Sample Input

{
    "file_url": "https://example.com/sales_data.xlsx",
    "scope": "current_run",
    "worksheets_to_extract": \{
        "worksheet_names": [
            "Sales 2022",
            "Sales 2023"
        ]
    \},
    "has_header": true,
    "column_types": [
        [
            \{
                "name": "Date",
                "type": "date",
                "format": "YYYY-MM-DD"
            \},
            \{
                "name": "Revenue",
                "type": "number",
                "format": "0,0.00"
            \},
            \{
                "name": "Product",
                "type": "text"
            \}
        ],
        [
            \{
                "name": "Date",
                "type": "date",
                "format": "YYYY-MM-DD"
            \},
            \{
                "name": "Revenue",
                "type": "number",
                "format": "0,0.00"
            \},
            \{
                "name": "Product",
                "type": "text"
            \}
        ]
    ],
    "ignore_rows": 0,
    "use_utf8": false
}

Sample Output

{
    "results": [
        {
            "id": "csv_1234567890",
            "columns": [
                \{
                    "name": "Date",
                    "type": "date",
                    "format": "YYYY-MM-DD"
                \},
                \{
                    "name": "Revenue",
                    "type": "number",
                    "format": "0,0.00"
                \},
                \{
                    "name": "Product",
                    "type": "text"
                \}
            ],
            "rows": 250
        },
        {
            "id": "csv_0987654321",
            "columns": [
                \{
                    "name": "Date",
                    "type": "date",
                    "format": "YYYY-MM-DD"
                \},
                \{
                    "name": "Revenue",
                    "type": "number",
                    "format": "0,0.00"
                \},
                \{
                    "name": "Product",
                    "type": "text"
                \}
            ],
            "rows": 180
        }
    ],
    "errors": []
}

Create CSV From XML File

Create a temporary CSV for use within the current workflow execution from an existing XML file. You can perform operations on this CSV within a single workflow execution, but will need to export the CSV at the end otherwise it will be deleted. Sample Input Sample Output

Delete a CSV

Delete a specific CSV created in Current Run and Account scope. Sample Input Sample Output

Delete column

Delete a specific column in the CSV. Sample Input

\{
    "id": "csv_12345",
    "column": "Age",
    "do_not_fail_on_non_existing": true
\}

Sample Output

Delete columns

Delete multiple column in the CSV. Sample Input

\{
    "id": "csv_12345",
    "columns": [
        "Age",
        "Phone Number",
        "Address"
    ]
\}

Sample Output

{
    "success": true
}

Delete Row

Delete a specific row in the CSV. Sample Input Sample Output

{
    "success": true
}

Delete Rows

Delete a number of rows in the csv. Sample Input

\{
    "id": "csv_12345",
    "start": 3,
    "count": 2
\}

Sample Output

{
    "success": true
}

Delete Rows By Filter

Delete all rows that match a specific filter. Sample Input

{
    "id": "csv_12345",
    "filters": [
        \{
            "column": "age",
            "operator": ">",
            "value": "30"
        \},
        {
            "match_any": [
                \{
                    "column": "city",
                    "operator": "=",
                    "value": "New York"
                \},
                \{
                    "column": "city",
                    "operator": "=",
                    "value": "Los Angeles"
                \}
            ]
        }
    ]
}

Sample Output

{
    "deleted": 15
}

Duplicate

Create a copy of a specific CSV Sample Input

\{
    "id": "csv_12345abcde",
    "scope": "account"
\}

Sample Output

{
    "id": "csv_67890fghij"
}

Duplicate Column

Duplicate a specific column in the CSV. Sample Input

\{
    "id": "csv_12345",
    "column": "First Name",
    "new_name": "First Name Copy"
\}

Sample Output

{
    "success": true
}

Export CSV

Export an in memory CSV into a file for persistence and use elsewhere. Sample Input Sample Output

Export File

Export an in memory CSV data into a plain text file using a template configuration Sample Input Sample Output

{
    "file": \{
        "name": "exported_data.csv",
        "url": "https://example.com/files/exported_data.csv",
        "mime_type": "text/csv",
        "expires": 1623456789
    \}
}

Export JSON

Export an in memory CSV into a JSON file for persistence and use elsewhere. Sample Input Sample Output

{
    "total": 100,
    "file": \{
        "name": "customer_data.json",
        "url": "https://example.com/files/customer_data.json",
        "mime_type": "application/json",
        "expires": 1623456789
    \}
}

Find Row

Find the first row in the table that matches a specific filter. Sample Input

{
    "id": "csv_12345",
    "filters": [
        \{
            "column": "age",
            "operator": ">",
            "value": "30"
        \},
        {
            "match_any": [
                \{
                    "column": "city",
                    "operator": "=",
                    "value": "New York"
                \},
                \{
                    "column": "city",
                    "operator": "=",
                    "value": "Los Angeles"
                \}
            ]
        }
    ]
}

Sample Output

Find Rows By Filter

Find rows in the table that match a specific filter. Sample Input Sample Output

{
    "found": true,
    "rowCount": 3,
    "data": [
        \{
            "id": "1",
            "name": "John Doe",
            "age": "35",
            "city": "New York",
            "job_title": "Senior Manager",
            "salary": "120000"
        \},
        \{
            "id": "2",
            "name": "Jane Smith",
            "age": "42",
            "city": "Los Angeles",
            "job_title": "Director",
            "salary": "150000"
        \},
        \{
            "id": "3",
            "name": "Mike Johnson",
            "age": "38",
            "city": "Chicago",
            "job_title": "Project Manager",
            "salary": "95000"
        \}
    ]
}

Format CSV

Change the characters (such as delimiter and escape character) used in a CSV. This operation may be required for CSVs with embedded new lines and quote character in cell values. Sample Input Sample Output

{
    "file": \{
        "name": "formatted_output.csv",
        "url": "https://example.com/formatted_output.csv",
        "mime_type": "text/csv",
        "expires": 1623457789
    \}
}

Generate columns from object

Generate a list of column descriptions from a JSON object (ignoring nested arrays and objects), and provide optional column type definitions to change the types of some fields. Sample Input

{
    "object": \{
        "id": 1234,
        "name": "John Doe",
        "email": "john.doe@example.com",
        "age": 30,
        "is_active": true,
        "registration_date": "2023-05-15T10:30:00Z",
        "balance": 1234.56
    \},
    "column_types_override": [
        \{
            "name": "registration_date",
            "type": "date",
            "format": "YYYY-MM-DD"
        \},
        \{
            "name": "balance",
            "type": "double",
            "format": "0,0.00"
        \}
    ]
}

Sample Output

{
    "result": {
        "columns": [
            \{
                "name": "id",
                "type": "number"
            \},
            \{
                "name": "name",
                "type": "text"
            \},
            \{
                "name": "email",
                "type": "text"
            \},
            \{
                "name": "age",
                "type": "number"
            \},
            \{
                "name": "is_active",
                "type": "text"
            \},
            \{
                "name": "registration_date",
                "type": "date",
                "format": "YYYY-MM-DD"
            \},
            \{
                "name": "balance",
                "type": "double",
                "format": "0,0.00"
            \}
        ],
        "number_of_columns": 7
    }
}

Get Cell

Return the data in a specifc cell in the CSV. Sample Input Sample Output

Get Column Count

Return the number of columns that are available in an in memory CSV. Sample Input

{
    "id": "csv_12345"
}

Sample Output

{
    "columns": 5
}

Get column from rows

Return a single column from a number of rows from in the CSV. Sample Input Sample Output

Get Row

Return all columns from single row in the CSV. Sample Input

\{
    "id": "csv_12345",
    "row": 3
\}

Sample Output

{
    "found": true,
    "row": 3,
    "data": \{
        "name": "John Doe",
        "email": "johndoe@example.com",
        "age": "35",
        "city": "New York"
    \}
}

Get Row Count

Return the number of rows that are available in an in memory CSV. This doesn't take into account content. Sample Input Sample Output

{
    "rows": 1000
}

Get Rows

Return all columns from a number of rows from in the CSV. Sample Input

\{
    "id": "csv_12345",
    "row": 1,
    "count": 3
\}

Sample Output

{
    "found": true,
    "total": 3,
    "rows": [
        \{
            "Name": "John Doe",
            "Email": "john.doe@example.com",
            "Age": "35"
        \},
        \{
            "Name": "Jane Smith",
            "Email": "jane.smith@example.com",
            "Age": "28"
        \},
        \{
            "Name": "Bob Johnson",
            "Email": "bob.johnson@example.com",
            "Age": "42"
        \}
    ]
}

Import Data

Import an external CSV file into an existing in memory CSV Sample Input

\{
    "id": "csv_12345",
    "file_url": "https://example.com/data.csv",
    "has_header": true,
    "delimiter": "comma",
    "escape_char": "\\",
    "enclose_char": "\"",
    "end_line": "auto_detect",
    "max_header_length": 10000,
    "max_first_row_length": 65535,
    "validate_csv_settings": true
\}

Sample Output

Join CSVs

Join two CSVs together based on a common field, using a left, inner or outer join. Indexes will automatically be created on for the columns chosen. Sample Input Sample Output

{
    "id": "csv_345678",
    "columns": [
        \{
            "name": "employee_id",
            "type": "string",
            "format": ""
        \},
        \{
            "name": "first_name",
            "type": "string",
            "format": ""
        \},
        \{
            "name": "last_name",
            "type": "string",
            "format": ""
        \},
        \{
            "name": "department",
            "type": "string",
            "format": ""
        \},
        \{
            "name": "salary",
            "type": "number",
            "format": "currency"
        \}
    ],
    "rows": 150
}

Parse Text

Parse raw CSV text into a list of rows Sample Input

\{
    "text": "Name,Age,City\nJohn Doe,30,New York\nJane Smith,25,Los Angeles\nMike Johnson,35,Chicago",
    "delimiter": "comma",
    "escape_char": "\""
\}

Sample Output

Rename Column

Rename a specific column in the CSV. Sample Input

\{
    "id": "csv_12345",
    "column": "First Name",
    "new_name": "Given Name"
\}

Sample Output

Rename Columns

Rename a number column in the CSV. Sample Input

{
    "id": "csv_12345",
    "columns": [
        \{
            "column": "First Name",
            "new_name": "FirstName"
        \},
        \{
            "column": "Last Name",
            "new_name": "LastName"
        \},
        \{
            "column": "Phone Number",
            "new_name": "PhoneNumber"
        \}
    ]
}

Sample Output

{
    "success": true
}

Sort CSV

Sorts a CSV. Sample Input

{
    "id": "csv_12345",
    "sort": [
        \{
            "name": "Age",
            "direction": "ASC"
        \},
        \{
            "name": "LastName",
            "direction": "DESC"
        \}
    ],
    "make_copy": true
}

Sample Output

Update by Function

Update a single column in multiple rows using a function Sample Input Sample Output

{
    "affected_rows": 150
}

Update Cell

Update a specific cell in the CSV Sample Input

\{
    "id": "csv_12345",
    "row": 3,
    "cell": "Email",
    "value": "john.doe@example.com"
\}

Sample Output

{
    "success": true
}

Update Rows by Filter

Set new values in all rows matching given filters, in the CSV Sample Input

{
    "id": "csv_12345",
    "cells": \{
        "Status": "Completed",
        "LastUpdated": "2023-05-15"
    \},
    "stringify_boolean": true,
    "filters": [
        \{
            "column": "OrderDate",
            "operator": ">=",
            "value": "2023-01-01"
        \},
        {
            "match_any": [
                \{
                    "column": "Category",
                    "operator": "=",
                    "value": "Electronics"
                \},
                \{
                    "column": "Category",
                    "operator": "=",
                    "value": "Appliances"
                \}
            ]
        }
    ]
}

Sample Output

Was this page helpful?