Use the “Read Range” activity to read the Excel file into a DataTable, let’s call it excelDt.
Specify the Value to Search:
Define the value you want to search for, such as “A11277”.
LINQ Query:
Use a LINQ query to search for the value in Column A of the DataTable and get the index of the first occurrence.
excelDt.AsEnumerable().Select(Function(row, index) If(row(“ColumnA”).ToString() = “A11277”, index + 2, -1)).FirstOrDefault()
excelDt.AsEnumerable(): Converts the DataTable into an enumerable collection of DataRow objects.
Select: Projects each DataRow into a new form. We check if the value in “ColumnA” matches the search value. If it does, we return the index of the row plus 2 (since row indices in Excel start from 1 and LINQ uses zero-based indexing). If not, we return -1.
FirstOrDefault(): Returns the first element of the sequence or a default value (-1) if no element is found.