Iterating through excel


I am current doing document understanding,

I have read an invoice however some invoices have multiple line items, I have alot of invoices that I need to iterate through, I have to iterate through regular fields and line items.

I want to have an invoice number for each line item as I iterate through the invoice. for example if I have 5 items I need the invoice number to show 5 times next to those items, I need to iterate through each item and store nvoice number in the excel.

the table above does not take into account that one invoice belongs to the 6 items, I am taking the invoice number from another table and storing it in the line items

my code:

@Aki1111 ,
Can you please Elaborate what data does DT2 Contain and DT1 Contain.
If possible Please share the sample Input file.with DT1 data and DT2
Also Dont keep same name for both for each loop(row) from the above image we can see that you set the currentrow as row for both the loops Just change one of them to CurrentRow.


DT2 contains the follow data: Regular fields (Bare in mind I went through two documents and extracted this data)


DT1 contains the line items and one regular field which is invoice number: