Question regarding Excel Activities

Hi there, I’m just wondering about for-each loop on excel sheet, can we try for-each loop from bottom to top, instead of from top to buttom? I would like to go back to excel sheet to find out the previous date.

well you could use the loop and after use the filter function to filter on a specific date or older date first.

1 Like

Hey @usertest114 ,

Another option here would be instead of ForEachRow, read the entire datatable, and iterate it backwards using row index.

Assumption:

InitIndex = 0
MaxRows = dt_excelSheet.Rows.Count (assumption = 100)

Then with a While/Do while activities, use the following inside an assign

CurrentRow = dt_excelSheet.Rows(MaxRows - InitIndex)

At the end of the While, just add 1 to the CurrentIndex, so on next iteration, you check the Row 99,98… and so on until the row 0.

Basically as a summary, you start from index 100 (Max number of rows) and you subtract 1 each iteration, until the end.

Hope this helps!

Best Regards,
Ignasi

1 Like

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