How to merge two data table which is having diff no of rows

I have extracted the different format invoices data. All the fields data (like invoice no, invoice date .etc )is in one Data table ex.DT1 and all the invoice table data (like description, qty, price) is in another data table.

for example DT1 and DT2 is like this

image DT1

image DT2

I want save the all extracted data in one sheet.

image

This is just a example I have multiple invoices.
In the for each loop it is extracting the data and creating DT1 and DT2.

If I use merge activity for DT1 and DT2 getting output like this.

How can I get the output in correct format??

@Yogita

Check below thread for your reference

Hope this will help you

Thanks

@Srini84

Thanks for reply.

This solution may be work when all invoices extracted fields are same.

In my scenario Invoices are different and column data of each invoice is vary from another,
So I am saving the data in different sheet if invoices having same format then next invoice data append to that sheet.

You can use two Write Range for each data table.

For DT1, use cell A1,
for DT2, use cell this value in the cell:
Convert.ToChar(Convert.ToUInt16("A"c)+DT1.Columns.Count)

Hope this helps.

Hi,

Just simple thought. please try and let us know. thanks.

use two work book write range activity one for DT1 and DT2.

Write range 1 → input DT-> DT1 and Range ->“A1”

Write range 1 → input DT-> DT2 and Range ->“C1”

Hi @Charbel1

thank you for the input.

tried this way , successfully able to extract desired format in excel, just need to provide different sheet for each invoice.

But , I want output like , if same invoice format comes , data output of corresponding invoices shall come in next row , Using your suggestion , it is over writing the previous invoice data.( same Format).

any suggestion.

Hi @kirankumar.mahanthi1 ,

Yes it will work if columns are same.

But I required the dynamic.

This is poor design. The Invoice_No and Invoice_Date values should be repeated for every row.

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