> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keyflow.space/llms.txt
> Use this file to discover all available pages before exploring further.

# Update CSV Column

### **Overview:**

The `Update CSV Column` block allows users to efficiently modify an existing CSV file by either updating a designated column with new data or adding a new column altogether.

***

### Inputs & Outputs

| I/O    | Feature                 | Type      | Simple Explanation                                                                                         |
| ------ | ----------------------- | --------- | ---------------------------------------------------------------------------------------------------------- |
| input  | `csv_file_name`         | file      | The target CSV file that needs modification, which must be in .csv format.                                 |
| input  | `column_index`          | number    | Identifies the position of the column to update (0 for the first column).                                  |
| input  | `has_headers`           | boolean   | Indicates whether the first row contains headers, helping determine how to process incoming data.          |
| input  | `is_new_column`         | boolean   | Specifies if the designated column for updating is newly created or has existed previously.                |
| input  | `column_contents`       | string\[] | New values that will populate into the specified column; each entry aligns with a row in the original CSV. |
| output | `updated_csv_file_name` | file      | The resultant new CSV file name generated after incorporating updates or new columns.                      |

***

### Use Cases

Here’s how this block can streamline various tasks:

* **Merging New Data:** Suppose you’ve collected additional metrics from an ongoing project and need to integrate these into your existing dataset—this block facilitates seamless merging without losing any previous information.
* **Correcting Errors:** If you discover discrepancies within your dataset due to incorrect entries, this tool allows easy corrections by replacing erroneous values in designated columns effectively.
* **Adding Calculated Fields:** When analyzing sales data over different periods, you might want to add a calculated “growth rate” field based on other figures—this block enables creating dynamic fields directly linked to your underlying data.

In essence, any scenario requiring updates or enhancements within a CSV can be efficiently handled using the `Update CSV Column` block!
