Get row data from Excel

Hi All,

I have an excel,from which i need to extract a particular row on the basis of one particular

column value.

Pfa Attached the screenshot,where on the basis of EAN no,i have to get complete row details.
I thought of reading the complete excel and then thru some querry get complete row somehow.

can anyone suggest best approach to do so.

Extract the datatable from the excel sheet using “Read range” activity inside Excel Application Scope. Let’s say your datatable variable is dtExcelTable and the row variable for the row you need is ‘row’. Once you have this table, use assign activity and do this:

row = dtExcelTable.Select(“[EAN Code]=‘8907122008520’”)(0)

The above code will give you the row item you need.

@siddharth:Thanks,however getting this error:-
cappture2

@prateekjain1992
Make sure that the variable type of the “row” variable is [DataRow].
After that, you will be able to play around with the “row” variable like row(“Size”).ToString or row(3).ToString to get the value of the Size column.

Cheers!

As @hojoong.kim said, you have to declare the “row” variable as a [DataRow] variable first. Using this DataRow object, you can access the cell values either as row.item(“EAN Code”)/row.item(2) OR merely as row(“EAN Code”)/row(2) as mentioned above.

NOTE: the indexes in the DataRow object starts with 0. Hence the index 2 denotes “EAN Code”.