How to Extract the Specific Range From the Excel DataTable

Hello

I want to Filter the Data Between the Row Number 5 & 10.

Row Number 5 and 10 is Fixed.

image

hi @kishan.savaliya ,

Any condition you need on filtering the rows?

Kind regards,
Kenneth

@kishan.savaliya

when the range is fixed:

  • we can use it for the read range configs and set the range info to: A6:C9

Another common technique is:

  • read in the full worksheet with e.g. read range -dtData
  • Assign Activity:
    dtExtract | dataType: DataTable =
    dtData.AsEnumerable.Skip(5).Take(4).CopyToDataTable
1 Like

This is not Fixed …Multiple Rows Can Come

Row 5 text and Row 10 Text is Fixed

Row number Can be vary

then we would recommend the second approach as it can be parametrized / generic calculated

hi @kishan.savaliya ,

We can make this approach:

  1. Put the values of the Row 5 text and Row 10 text into a String Array variable.
    StringArrayVariable = {“ABC3”, “ABC8”}
  2. Now, when you loop on each row of your data table we can add a checking/validation inside the For Each Row in DataTable with an If statement

If Statement
Condition: StringArrayVariables.Contains(CurrentRow(“Column1”).ToString)
Then: //do the actions for row 5 and row 10
Else: //do other actions.

I hope this helps. Happy automation!

Kind regards,
Kenneth