I am passing data from Excel to application. As per search result i am scrapping Data table.
I need to search “text” any where in table and relevant Row no. But the problem is No. of columns and there position gets change as per search result. I used below two methods to search -
- ExtractedRow(“Column-8”).Equals(“String to search”) or ExtractedRow(“Column-6”).Equals(“String to search”)
- ExtractedRow.ItemArray.ToList().Contains(“String to search”)
Issue with first method - When “Column-6” not found it gives error - Column-6 doesn’t exist. Because for some of the record Column-6 is not present in data table.
Issue with Second method - I am not able to find column name in which “String to search” present.
What I need is, First Cell value of the column in which “String to search” is present.
and how handle such kind of dynamic data table.
Attached screen shot shows data of Data table converted into Excel.