How to Rewrite Row of Duplicate in Excel Using ForEach

Hi all! I’m newish to uipath but had a question on how to go about making an automation for the problem below:

I would like to use a ForEach Row (the row is an invoice number) on DT1. If the invoice number does not exist in DT2 it appends the row to DT2. If the invoice number does exist on DT2, it replaces the entire row’s worth of data (minus a few columns, <- this is crucial) from DT1 into DT2.

Both DTs have identical Headers and can be adjusted if needed.

You can use LINQ or use two for each row in which you can compare your condition if true add data row.

1 Like

Example

  1. read dt1 and dt2
    image

  2. foreach dt1
    a) lookup dt2 using dt1 invoice number

  • if match exists, just replace some columns in dt2 e.g. replace Column2 and Column3 in the corresponding row in dt2
  • if no match, just add the row from dt1
    image
  1. write the new dt2 table
    image

This is the updated dt2
image

Heres my sequence/excel
dt2.xlsx (8.3 KB) dt1.xlsx (8.3 KB)
Sequence.xaml (10.5 KB)

1 Like

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