Need to append row at the bottom of the excel

Hi,

I need to create one excel with two columns(Sequence Id, Status) for generating the report of invoice process.

Step1: I used Build Data Table activity to add the Column headers as Sequence Id and Status

Step2: Used Add data row activity and mentioned two ArrayRow(Seq_Id and Status)

Step3: Used write range activity to write the data table into an Excel.

While using write range activity by default Range set as A1, If the BOT start processing next seq_Id its not appending a new row.

Its owerriting the existing row. How can I append row in excel?

Can anyone help me on this?

Thanks,
Jose

1 Like

@shajanjose Use append range activity instead of write range activity

Thanks Manju, Now I can able to append rows. But if I use Append Rang I am not able add headers.

@shajanjose append range is used to add to existing excel, It already contains headers right

2 Likes

Use your excel application scope part at the very end once you’ve processed ALL values of seq_Id.
Once you do, the entire datatable can be added onto the excel sheet at once.

New excel we are creating, it will create at Run time.

@shajanjose if excel doesnt have data u can use write range itself right

yes, thats what I used initially. But the thing is we are processing multiple Sequence Id and writing the report in excel.

I am using only one variable(Seq_Id) to store the Sequence Id. So every time BOT process the new Sequence Id it will replace with the latest one. So I need to write the excel in Run time.

Is there any way to append datatable? so I will append rows in data table and finally write the entire table to excel using write range.

@shajanjose Use build datatable activity and create required number of columns to it, use add row activity and add data to datatable in each loop run, at last write that datatable to excel.

This is what I tried, its not working

@shajanjose In this pic ur reading data and writing data to same datatable

I build a Data Table(DT) and add rows in it, then writing the same Data Table into an Excel…

@shajanjose From where ur getting sequence id and status?

Hi,
Step 1:Take build data table have a 2 columns say Sequence id and Status and
name it as Dt
Step 2: Take for each row pass the dt, get 2 get row item name it as sequence
and status as variable name
Step 3: Now take wrtie range activity and pass the Dt
or Use append Activity pass the datatable hopefully it will work

hopefully it will work :slight_smile:)


image
image

Regards,

I am getting below error message while trying to add Get row item activity,

None of the overload groups have all their required/Optional activity arguments configured

Hi,
please find the workflow
Main.xaml (16.9 KB)

You can add if condition to check if the file exists in that folder. If it does not exist, write activity can be used which will create a file and write the data. If the file exists, use append activity to append the data to the file. Hope this helps.

2 Likes