For each loop for new appended Rows

Hello everyone,

I am looking for some help.

I am trying to do a for each row Loop from a data table. This is very easy to set up. However, the Excel file will get more and more rows (per append range activity). Now, if I start the for each row Loop it starts with row 1 again, but I don’t want to process These rows anymore. I want to process only the newly appended rows. I created a countrow variable which contains the number of rows that are in the Excel file before new rows are added, but how can I start the Loop with that variable from the newly appended row?

For example: I have 7 rows in the Excel file, all are already processed. Then, I append 3 more rows. Now I want to process These 3 newly appended rows and not start from the first row again. And then after that I add 5 more rows or 4 more rows (variable amount) and process them again.

Hope someone can help me :slight_smile:

Kind regards

1 Like

Add one more column to the excel say status.
Once you process the row, set the status as completed.

Next time when you read the excel, filter the rows (which are not completed) based on Status column.

Regards,
Karthik Byggari

1 Like

Is this the only way to do it? Or is there a Workaround without adding a Status row? :slight_smile:

1 Like

You can loop like below with the count number with for loop -

For index = countrow+1 to datatable.Rows.Count-1
       datarow = datatable(countrow)
1 Like

What activity do I use for that?

1 Like

For each activity only -

For Each index in dt.Rows.Count

2 Likes

I don’t get it work.

I do a for each index = dt.Rows.Count and it says it cannot convert Integer to Systems.Collections.IEnumerable…

1 Like

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