How to append 2 datatables to the same excel sheet (Data is different in both)

image

Want both of them in the same excel sheet in the same order

Hi @Sami_Rajput

β†’ Use the assign activity to store the row count of dt1 in a variable called dt1count it is a int32 datatype variable.

- Assign -> dt1count = dt1.Rows.Count

β†’ Use another assign activity to store the row count of dt2 in a variable called dt2count it is a int32 datatype variable.

- Assign -> dt2count = dt2.Rows.Count+dt1Count+2

β†’ Do one thing first use the write range workbook to write the first datatable to excel.
β†’ After that use another write range workbook activity to write the second datatable to same excel sheet by giving the range like β€œA”+(dt1Count+2).ToString+β€œ:G”+dt2Count.ToString

Check the below workflow for better understanding,

It’s working for me

Hope it helps !!

1 Like

First, write the initial DataTable to an Excel file. Then, read the same Excel file again to determine the row count. Using this row count, perform a new write range operation on the same path as the first DataTable. In this new write range, use the range starting from the row count + 2 of the first DataTable.

1 Like

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