## Related terms

- data\-transformation
- import
- attribute
- automation\-module

See the [glossary](/glossary.md) for definitions.

---

# Rename Columns


Because the names of the columns are the keys under which the data will be imported to Synerise or appear in the output file, you can change them to meet the requirements by using the **Rename column** transformation step.

In the settings of this step, you must select the columns that will be renamed. You can do this by selecting particular columns or you can create a condition that the column names must meet in order for the transformation to be performed on them, for example, the column name must start with the letter "A".

## Step configuration
---

<figure><img src="/api/docs/image/1f259bfffcc725db385aae0958fd8b1c76b4f9a8/docs/automation/_gfx/dts-rename-column.png" class="medium" alt="Configuration of the Rename column step with the list of renaming methods"><figcaption>Configuration of the Rename column step</figcaption></figure>

1. In the Data Transformation Studio, [add](/docs/automation/data-transformation-and-imports/creating-data-transformation#add-transformation-steps) the **Rename column** step.
2. [Indicate the columns](#selecting-columns) to rename.
3. From the **Rename by** dropdown list, select one of the following options:
    - **Replacing** - Select this option if you want to entirely change the column name, for example, from `type` to `promotion_type`
    - **Adding prefix** - Select this option if you want to add a group of letters at the beginning of a column name, for example, applying a `promotion` prefix to the `Name` column transforms it into `promotionName`
    - **Adding suffix** - Select this option if you want to add a group of letters to the end of a column name, for example, applying a `.promotion` suffix to the `code` column transforms it into `code.promotion`
4. In the field next to the dropdown list, enter the value.
5. To add more rules, click **Add rule** and repeat steps 2-4.
6. To define what happens if rows contain errors, from the dropdown list next to **Add rule**, select one of the [error handling](#handle-errors) options.
7. Confirm the settings by clicking **Apply**.
8. You can check the result in the **Output** tab.

### Selecting columns

In each rule of the step, you indicate the columns on which the operation is performed.

1. In the header of the rule, click **these** and select one of the options:
    - **these** - the operation is performed on the columns you indicate.
    - **all except these** - the operation is performed on all columns except the ones you indicate.  
2. From the first dropdown list in the rule, select how you want to indicate the columns:
    - **Columns** - from the **Select column** dropdown list, select one or more columns.
    - **Where name** - define a condition (a _dynamic condition_) that the column names must meet. Select a logical operator (**Ends with**, **Starts with**, **Contain**, **Not contain**, or **Regex**) and enter the value. For example, if you select **Starts with** and enter `pro`, the operation is performed on the columns whose names start with `pro`  
    Column names are case-sensitive, for example, `product` doesn't match `ProductCode`. A regular expression must match the entire column name, for example, `product.*` matches `productName`, but `product` doesn't. To ignore the letter case in a regular expression, add `(?i)` at the beginning, for example, `(?i)product.*`

You can't combine dynamic conditions with the **all except these** option.

Dynamic conditions are especially helpful when you use a JSON file as sample data. When a JSON file contains an object deeper than the root object, its items are transferred to the transformation as separate columns named `{object}.{parameter}`. You can't add those columns from the **Select column** list, but you can include them with a dynamic condition, for example, by including columns whose names contain the name of the object they were created from.

### Handle errors

You can define what happens with rows in which the step fails (for example, as a result of Jinja rendering). From the dropdown list next to **Add rule**, select one of the following options:
- **Skip row if error occurred** - It omits the row when an exception occurs.
- **Skip if result is null or empty string** - It omits rows with empty strings and `null` (which may be the result of rendering Jinja).
- **Stop further transformation** - The transformation stops at the row with an error. The data before the line that caused the error is transformed (and imported if the transformation is used in the Data Transformation Studio node).
- **Insert null if error occurred** - Wrong values are replaced with `null`. If you use such a transformation for the import of profiles, the existing value of an attribute is cleared and replaced with the `null` value.
- **Insert empty string if error occurred** - Wrong value is removed and the cell remains empty. 

## Example of use
---
You can replace the `email_address` column name with `email`, which is a required column name for Synerise imports. As a result, the data from this column will be imported as the `email` attribute.  


<details class="accordion"><summary>Sample data used in this example</summary><div class="accordion-content"><pre><code class="language-plaintext">name,surname,email_address Dwight,Addams,dwight.addams@test.com Martin,Smith,martin.smith@test.com Kurt,Doe,kurt.doe@test.com</code></pre></div></details>


1. In the Data Transformation Studio, [add sample data](/docs/automation/data-transformation-and-imports/creating-data-transformation#add-sample-data).  
2. Click **Add step** and select **Rename column**.
3. In the configuration of the step:
    1. From the **Select column** dropdown list, select **email_address**.
    2. Leave the **Rename by** dropdown list at default (**Replacing**).
    3. In the field next to the dropdown list, enter `email`
4. Confirm by clicking **Apply**.  
    **Result**: In the **Output** tab, the `email_address` column is renamed to `email`
