Adding two new column at the end of the excel sheet dynamically

hi
Actually my requirement is like this. I am having one excel in which I have to add two column in last. Column name “Prize” and “Owner”.
But my existing column range will be dynamic. So first we need to get last column and then add above two column. I am attaching the excel.
We have to add new column after column “Name” but “Name” column would be dynamic sometime its in “C” place or sometime in “D”
How to identify that?
test.xlsx (11.0 KB)

@sshitol

Read the data using read range and give range as only first cell…then it will read whole dat… countcol = dt.Columns.Count will give the column count…then use write range to add the columns you need by passing the cell value or range value as uipath.excel.helpers.excelutilities.convertcolumnindextocolumnletter(countcol)+ "1"

Assuming data starts from first row…

Cheers

@sshitol Check this below workflow attached,
Uipath_AddNewColumns_Dynamically.xaml (10.0 KB)

Hope this may help you :slight_smile:

HI,

Hope the following sample helps you.
In this case, we can achieve it handling datatable.

Sample20221228-3L.zip (20.3 KB)

Regards,

Hi @Anil_G ,

I tried but seems not working. Could you pls provide me .xaml file

HI @Manish540 ,

I tried but not working. Could you please try with my attached excel rather than build data table

HI,

Sorry but the above my sample insert columns just before Name column.
The following will insert them just after Name column.

Sample20221228-3Lv2.zip (20.3 KB)

Regards,

@sshitol Can you check the updated workflow attached below,

Uipath_AddNewColumns_Updated.xaml (17.9 KB)

Hope this may help you :slight_smile: