How to stop for each row activity

For my case, my excel file got a lot of rows of data but i only want to retrieve the first 3 row of the data. How do I achieve this?

Hi @Xuan_Teo

You can do this in two ways:

  1. Read Range for only the rows you want.
    For example, if you want have 5 columns in your excel they would be A,B,C,D and E.
    If you specify range in Read Range activity as “A1:E3” then it will only bring the first three rows and 5 columns.
  2. For Each Row - Index variable
    For Each Row activity gives you an output variable called Index
    You can use this to check if Index<3 (it’s zero-based, i.e. the counting starts from 0)
    If Index < 3 Then process row
    Else Break (Break is another activity which stops execution of the for loop)
    In this case you won’t need to selectively read range.

Thank you! This help a lot to me!

1 Like

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