HumanFirst icon

HumanFirst

Call HumanFirst playbook API

Add Column to CSV

AI-generated

Overview

This node operation takes an input CSV file in binary format, appends one or more new columns with constant values to each row, and outputs the modified CSV file. It is useful when you need to enrich existing CSV data by adding additional columns with fixed values, such as adding metadata or categorization columns to a dataset.

Use Case Examples

  1. Adding a 'Status' column with the value 'Active' to a CSV of user data.
  2. Appending a 'Source' column with a constant string to track the origin of the data.

Properties

Name Meaning
Columns to Add A collection of column name and value pairs to append to the CSV. Each pair specifies the new column's header and the constant value to add for every row.
Delimiter The delimiter character used in the CSV file, defaulting to a comma. This is used to correctly parse and reconstruct the CSV lines.

Output

Binary

Outputs the modified CSV file as binary data with the new columns added.

JSON

  • columnIndices - An object mapping each column name to its index position in the modified CSV header row.

Troubleshooting

  • Error 'No binary.csv found to modify' indicates the input item does not contain a binary CSV file under the expected property. Ensure the input data includes a binary CSV file named 'csv'.
  • Incorrect delimiter may cause malformed CSV output. Verify the delimiter matches the input CSV format.
  • If the CSV has trailing empty lines, the node skips appending columns to those lines to avoid corrupting the file.

Discussion