Rename Column
Rename Column
Section titled “Rename Column”Type: rename-column · Package: DataTable Activities v1.0.5 · Output: DataTable
Changes the name of a column of a DataTable and returns a new table. Useful to normalize headers before combining tables with Join, or to give readable names to columns that come from a source with unclear titles.
How it works
Section titled “How it works”Copies the table and renames column to newName, keeping its position, type and data. The lookup of column is case-insensitive. The original table does not change.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
table | DataTable | — | The DataTable to modify. |
column | string | — | Current column name. |
newName | string | — | New name. It must not match another existing column. |
Optional parameters
Section titled “Optional parameters”None.
Output
Section titled “Output”Returns a new DataTable, identical to the original except for the column name.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'table' must be a DataTable. | table does not evaluate to a DataTable. |
'column' is required. / 'newName' is required. | The current or the new name is missing. |
Column '…' not found. | The column to rename does not exist. Check the name. |
A column named '…' already belongs to this DataTable. | newName is already the name of another column (.NET message). Remove that column first with Drop Column or pick another name. |
Example
Section titled “Example”Rename Column table = data column = "col1" newName = "Customer" → output: readableJoin DataTable left = readable right = customers on = "Customer" → output: completeRelated activities
Section titled “Related activities”- Drop Column — remove columns.
- Join DataTable — join tables on a common column.