Excel Append Range: Check if row already exists in worksheet

Ok, so this is an interesting issue I’ve run across. I am scraping data from a website and inserting it into Excel. I am using the Append Range activity to do so.

The table I am scraping contains 10 days worth of data. However, this workflow will not be included in our Orchestrator. It will be run on-demand.

So, if I were to run the workflow, say, every 5 days, I get 10 more rows from the website table added to my worksheet of which, 5 were already added. So I have duplicate data.

E.G.
Row 1: Hello
Row 2: World
Row 3: This
Row 4: Is
Row 5: Me
Row 6: It
Row 7: Is
Row 8: Good
Row 9: To
Row 10: Meet You

<Start workflow 5 days later (instead of 10)>
Row 11: It (Duplicate data)
Row 12: Is (Duplicate data)
Row 13: Good (Duplicate data)
Row 14: To (Duplicate data)
Row 15: Meet You (Duplicate data)
Row 16: How
Row 17: Are
Row 18: You
Row 19: Doing
Row 20: Today

So I put in a data table in the workflow and filled it with the rows from my spreadsheet. Then I tried a FOREACH ROW to compare the rows in from the worksheet(Datatable A) to the rows in the scraped DataTable (Datatable B), but I can’t for the life of me figure out how to conditionally remove the duplicate rows from the datatable that I want to use for the Append Range activity.

Any suggestions?

Thanks!

@godfathr

After appending dataTable to the existing dataTable use below expression to delete duplicate records.

dataTablename.Defaultview.ToTable(true,“ColumnName”,…). CopyToDataTable

@lakshman Thanks! Let me give that a try.

1 Like

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