You can get the range as datatableMerged.Rows.Count and then you can use add data column to add the data you want to within the for each row so that it will add the required column before merging the next datatable @smita.mobifly
Assuming that you have 4 excel files to be merged, is it possible to merge all the 4 excel files into the single datatable and then add the “Merged file”?
its working, but while adding data into last column it replace with new data
while merging 1st excel, added state code TN
and 2nd excel having state code AP, so AP Replaced with TN into last column
As per my understanding, this is an overwrite issue.
While adding a new column in the second excel, the value is been overwritten.
In this case, please be very cautious and alert regarding the order of the flow and the executing sequence.
Also please ensure that adding new column range is in place.
In this case we need to add datacolumn while taking value from each excel as a datatable
Hope this steps could help you resolve this
—inside the for each loop after getting the datatable from excel with read range and getting the output with a variable of type datatable named outdt
—next to this use a activity called ADD DATACOLUMN where mention the datatable where we want to add the new column and mention the columnname within double quotes so that it will get added at the last with that name
—now we can add value to that column
And doing this for all
—Final all we can merge so that we won’t miss any value of a datatable
Kindly correct me if I m wrong with question and try this, let know for any queries or clarification