How to convert excel sheet to data table and add 2 additional columns with some specific values in uipath?

How to convert excel sheet to data table and add 2 additional columns with some specific values in uipath?

1 Like

@Chandni

Use Read Range activity inside the Excel Application Scope activity and mention sheet name you want to read from excel file. The output of Read Range activity is DataTable.

Use Add Data Column activity to add column to existing data table.

Hi Buddy, @Chandni

Here is your xaml that could resolve your issue

The steps included are,

  1. Use open excel application scope to get the excel first
  2. Use a read range activity to get the datatable from the Excel with output variable out_dt
    3.now use add data column activity to add the data column with the name you want…like column1
  3. Again the same activity to add one more column…here you can have only one activity within a for each loop( not for each row loop) to add certain number of columns…

Another suggestion is if you want to add columns at specific position, you can use invoke method with object out_dt.Columns.Add and method as SetOrdinal. Where you can mention the position with parameter property of this activity…

All these are added in this workflow buddy

adddatacolumn_1.xaml (11.4 KB)

Cheersr

@Chandni,

It’s very simple.

  1. Can you please use Excel Scope Activity inside that add read range activity to specify your column Name and Range. The output of Read Range activity is DataTable. e.g(Data1)
  2. Use ADD Data Column activity to add the column to the existing DataTable (Data1).

Can you please check this file.
Here I have created Excel, using add Column activity to add the column name “Booking new status” column.

AddColumnIntoDataTable.zip (9.3 KB)

Thanks,
Arunachalam.

2 Likes

@Chandni,

May I know you got solution for this?

Thanks,
Arunachalam.

Yeah., I got it, thanks everyone for your help :smiley:

1 Like

@Chandni,

Great :grinning: Can you please make a solution so that our folks can get info on this post.

Thanks.
Arunachalam.