Problem with datatable append

Hi all,
i’m working with REFramework. I’ve the transactionItem of type datarow, and this is a single row of my datatable that contains 4 columns(id,name,surname,age).
During the process, i need to retrieve two information from a web extraction(phone,email). Now my question is: if i want to append, at the end of each transaction, the information of my DT1 with 4 columns, and also the two information retrieved(phone, mail) but consider that my excel file has 20 columns. How can i achieve that?

Hello @legiw18734,

As per your problem statement, your row is a transaction item and it has only 4 columns that imply you are reading only those 4 columns (for ex .A1:D10 or AA:DD)
The second part implies that your excel has 20 columns and you need to append these 6 columns from DT1 into this excel file. That means 2 extra columns which make a total of 22 columns in excel.
Now as per your need, you can either insert two columns in this excel file and append data or you can build a new data table and merge both dt together and right it back to your excel file.


welcome to uipath forum

in that case first read the excel file using READ RANGE activity and get the output as datatable named dt

then use a CLEAR DATATABLE activity and pass dt as input
this dt will now have only the schema and no data in it

  1. then while adding data with ADD DATAROW
    mention like this

ArrayRow = {value1, value2, value3, value4, value5, value6, …valueN}

mention like this String.Empty for those column which doesnt have value

that is say you dont have value5 so mention like this
{value1, value2, value3, value4, String.Empty, value6, …valueN}
the main intention is to include values for all the 20 columns in that datatable dt

and in datatable mention as dt

then we can use APPEND RANGE or WRITE RANGE activity with the same excel filepath as input and dt as input data

Cheers @legiw18734

1 Like

Thanks for the reply.
I need to write the row after each transaction number, so i don’t want to add datarow instead of having same rows appended every time.

that can done in two ways

either first we can write data in each row for each transaction and finally write that datatable to excel


we can write to each cell for each transaction one by one

Cheers @legiw18734

So, can i write range my DT1(4 columns) to the excel file and use the transaction number to write cell (column5 and 6) after each transaction number? There’s a more clean solution in your opinion?

yeah that would work either

its possible

where we need to get the cell position with row count and increment it for every transaction