How to Add Column in the same Excel sheet?

excel
studio

#1

What i need to achieve is adding new column and name it. I am very new to UiPath and need your help
Screenshot%20(1)

Thank you in Advance


#2

You can write the column name with the help of using write range or write cell based on write range unchecked add headers property and write cell you can mention the range as C1 and write the header
Thanks
Ashwin.S


#3

Thank you so much for the this. Will try as soon as I’m home and will let you know.

Thank you again


#4

@TonyZira
Read your Excel sheet by using read range activity and store it in a datatable variable dt

Then use Add Data Column Activity to add new column.

Then use write range activity to print in excel sheet.

Regards,
Mahesh


#5

Thank you @AshwinS2 and @MAHESH1. I am able to add Column now!

May i go ask few more questions?

How to subtract if Col1 is less than Col2 and not (Else) Multiply and inset the result to Result column?

I appreciate so much!


#6

@TonyZira

You can try this, if your column 1 and column 2 values are integers try this

List A = From p in dt.Select()
Select if(Convert.ToInt32(p(“Col2_Name”).ToString)>Convert.ToInt32(p(“Col1_Name”).ToString),Convert.ToInt32(p(“Col2_Name”).ToString)-Convert.ToInt32(p(“Col1_Name”).ToString),Convert.ToInt32(p(“Col2_Name”).ToString)*Convert.ToInt32(p(“Col1_Name”).ToString))

List A will have the values, so run the for each and use assign activity to update the values in datatable. you can get lot of posts, to know how to update the list to a particular column

If your column values have decimal values then convert it to double values.
Sorry if i missed any brackets

Regards,
Mahesh