Use the Insert column action in Automation 360 Data Table package to add a new column to any table from an existing source table, or create a custom column with a specific data type and default value.
Insert column action is useful when you need to:
- Extend a table with data from a second source table before joining or merging.
- Add a calculated or placeholder column (such as a status flag, date stamp, or category label) to an existing table.
- Append a column at a specific position, such as beginning, end, or at an exact index.
Prerequisite
- The destination data table must already exist as a variable in the task. If it does not, create a new table variable before using this action.
- When inserting from a source table, the source table must contain the column you want to copy. The source and destination tables do not need to have the same number of rows.
- The column structure of the destination table must match the source table.
- When inserting a custom column, you can only add one column at a time. To add multiple custom columns, use the Insert column action multiple times.
- Column index positions start at 0. The first column is index 0, the second is index 1, and so on.
- If you select Datetime as the column type for a custom column and leave the default value empty, the action uses the current system date and time at the moment the bot runs.
Settings
- In the Destination table field, select the data table
variable you want to add a column to.
If no variable exists, click the Create variable icon to create a new table variable.
- In the Insert column at index field, select one of the
following positions:
Option Description First index Inserts the column as the leftmost column (position 0). Last index Appends the column after all existing columns. Specific index Inserts the column at the position you specify. Enter the index number (starting from 0). - In the Insert column field, select one of the following
options:
- From source table:This option pulls an existing column
from a second data table into your destination table. Select this option and
enter the following details.
- In the Enter data from field, select the source
data table variable that contains the column you want to copy.
- Specify the column to copy using one of the following:
- Column name to insert — enter the exact name of the column as it appears in the source table.
- Column index to insert — enter the numeric
position of the column. Note: The index count starts at 0. For example, to copy the third column from the source table, enter
2.
- In the Enter data from field, select the source
data table variable that contains the column you want to copy.
- Custom column: This option inserts a new, empty column
or a column pre-filled with a default value. This is useful for adding labels,
flags, or calculated fields that do not yet exist in any source table. Select
this option and enter the following details.
- In the Column name field, enter a name for the new column. This field is optional. If left blank, the column is created without a header.
- In the Column type field, select one of the
following data types:
Data type Use when String The column will hold text values. Number The column will hold numeric values (integers or decimals). Boolean The column will hold true/false values. Datetime The column will hold date and time values. Note: If you select Datetime and leave the Default value field empty, the action uses the current system date and time at runtime. - In the Default value field (optional), enter the value you want to populate in every row of the new column. If left blank, the column is created with empty cells.
Note: You can add only one custom column at a time.
- From source table:This option pulls an existing column
from a second data table into your destination table. Select this option and
enter the following details.
Examples
Example 1: Copy a column from a source table
You have two data tables: EmployeeData (containing Employee,
Department, and Pay rate columns) and EmployeeRegion (containing
Employee and Region columns). You want to add the Region column from
EmployeeRegion into EmployeeData.
- Drag or double-click Insert column under Data Table package.
- In Destination table, select
EmployeeData. - In Insert column at index, select Last index.
- In Insert column, select From source table.
- In Enter data from, select
EmployeeRegion. - In Column name to insert, enter
Region. - Click Save.
Result: The Region column from EmployeeRegion
is appended as the last column in EmployeeData.
Example 2: Add a custom status column with a default value
You have a data table called OrdersData and want to add a
Status column pre-filled with Pending for every
row.
- Drag or double-click Insert column under Data Table package.
- In Destination table, select
OrdersData. - In Insert column at index, select Last index.
- In Insert column, select Custom column.
- In Column name, enter
Status. - In Column type, select String.
- In Default value, enter
Pending. - Click Save.
Result: A new Status column is added to every row in
OrdersData, with each cell set to Pending.