Add 3 columns based on on existing columns

Input Excel

DATA1.xlsx (10.1 KB)

the Output which I am expecting

Thanks in Advance.


May I know what you mean based on existing?

the column names would be same? would you need to add 3 columns for previous date always?

if yes then build a datatable with 3 columns…then add datarow with array row as {Now.Adddays(-1).ToString("dd-MM-yy"),Now.Adddays(-1).ToString("dd-MM-yy"),Now.Adddays(-1).ToString("dd-MM-yy")}

then one more with required bank details

now use write range to write the data…and to get what is last column…you can first read the data usign read range then perform dt.Columns.Count which gives you the number of columns already present

UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(dt.Columns.Count+1) gives the column name

Hope this helps


is build a data table have blank column names?

Then using add data row adding the columns right?


Give any 3 column names no need to add columns…add datarow…and when you write uncheck header options…so only data is written

ideally yes in add datarow we are adding both the top two column names we need


Here Build data table & read range data table both are same or different?


Read range is to find out how many columns are already present

Build datatable is to create a new datatable with 3 columsn to add at the end of current columns


Can you please look into.


Hi @ManjunathReddy ,

Could you also provide us with the Expression used in the Range property ?

Also, If possible provide also the contents of the dt_Column datatable.

Range Property Code : UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(DT.Columns.Count+1)

For more clarification referrer the top post

@ManjunathReddy ,

The above expression alone is not sufficient, You should also add the Index or row number to it.


Didn’t get expected output.


@ManjunathReddy ,

So now, we do not have the Error in place, but the Output is wrong.

So we ask again what is the content in the dt_Column.

I just created the datatable to add the dates into it .


@ManjunathReddy ,


I believe @Anil_G has already mentioned the method in the previous post. Could you refer it ?

So, when using Write Range activity, Uncheck Add Headers option. It should be the desired output.


Two add data rows are needed and in write range remove headers check box

As per output i can see you did not add banks related add data row

Also did not uncheck headers in write range


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