Retrieve data from the merged column

Hi Everyone,

I am trying to retrieve data from excel based on the condition ID = yes in an excel but the sheet is merged. Can anyone given idea how to retrieve all the data in a row where ID is equal to yes.

Unitinfo.xls (25.5 KB)

Thanks,
Ulaga

Have you tried using Excel Application Scope with Read Range?. It should add your table into a DataTable. You can just filter your datatable from there.

Let me know if thats not what you are looking for.

Thanks,
Rammohan B.

Hi @Rammohan91 i am able to get the datatable using readrange but the thing is i want the rows value of excel which have the Last key value = yes. I have highlighted that row in yellow.

The ID value yes can be in any row in excel and struggling to get all the row values.

@Rammohan91 I resolved this issue using Linq concept.

Hi @Boopathi
You can use Dt.Select(“[Id]=‘Yes’”").CopyToDatatable()

(or)

(From p in dt.Select() where( From q in dt.Select() where q(“ID”).Equals(p(“ID”)) Select q).ToArray.Count>1 Select p).ToArray.CopyToDataTable()

Thanks
Ashwin S