Writing different Format of data to excel

I am using two different queries,fetching data from database and storing it in two data tables.
E.g: Datatable1 will have Transaction Id values , Datatable2 will have Respective Id mapping values.How can we place those table data in excel in below format


@ndivya Can u share screenshot or samples of datatables?

Please find below sample data table formats

dt1 dt2

@ndivya Please check below workflow .

Main.xaml (24.2 KB)

Thanks for your reply…
If we have first value as an interger and a separate variable and we need to compare it with datatable? how can we do this?

Eg: instead of datatable1 i will have an variable TransactionID=1
and datatable2 then how can we compare and write it to excel

@ndivya Try like below.

datatable2.Select("[Column1]=’"+TransactionID+"’). CopyToDataTable()

If TransactionID is integer, try to use TransactionID.ToString in select statement since Column1 column in datatable2 is of string type.

I need to append second column value if i found duplicate value other wise same value will remain,How can we achieve this.Input is :input

Out put should be :output


  1. From your datatable extract distinct values from Column1.
  2. Using for each loop get each value, based on that value get rows from input datatable, store the result in new datatable.
    3) From new datatable get values from 2nd
    column and join them using string.join command.
    4) add that the value and concatenated string to
    new datatable.
    5) repeat for other values.

can you please post sample Xaml…

@ndivya Please find attached workflow below.

Main.xaml (20.9 KB)

Thanks … It’s working as expected…

1 Like

@ndivya If you got solution close thread by marking appropriate solution.

I am trying to retrieve the data from database so , i was getting error when i am appending value to second column serror o how can we append result to new column in same datatable.