DATTABLE / EXCEL Add column with value

i have an excel, For e.,g

Column1,Column2
ABC,23
CBD,45
HDR,78

I need to insert a column in the above dt and the coulmn shold have value as “Yes”.

I need to achieve this without using for each as for-each loop takes more time.

The result should be like this.

Column1,Column2,Column3
ABC,23,Yes
CBD,45,Yes
HDR,78,Yes

Hi @Manikandasamy ,

Have you tried the Activity Add Data Column ? It has a property called Default Value which you could use it to update all values of that column to the specified value.

Hi @Manikandasamy

To add a new column in an Excel file using UiPath, you can use the Add Data Column activity. Here’s an example of how to use this activity:

  1. First, drag and drop the Add Data Column activity from the Activities panel onto the Designer panel.
  2. Next, specify the input for the activity by setting the properties in the Properties panel.
  • In the DataTable property, specify the data table that you want to add the new column to.
  • In the ColumnName property, specify the name of the new column.
  • In the ColumnType property, specify the data type of the new column (e.g., String, Integer, etc.).
  • In the DefaultValue property, specify the default value for the new column. This value will be used for all rows in the data table.

Thanks!!!

2 Likes

Hi @supermanPunch ,

Here is a simple sample for you.

DatatableAddColumn.zip (72.9 KB)

image

Regards
Balamurugna.S

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.