I am using C # .NET 3.5 in VS2010 on a Win 7 machine. I have an Excel worksheet and I want to extract the data stored in it. I know how to parse Excel when specifying a range of cells. Here we connect using OLEDB, give the SQL command and map it to DataTable, and then access the data.
select * from [sheetname$A2:N50]
where "sheet name" is the name of the Excel sheet, and "$ A2: N50" is the range of cells.
BUT, BUT, my requirement is completely different.
I cannot hard-set the range of cells as indicated above, since the location of the data cells can change dynamically. For example: the data stored in cell A20 can be changed to C14 in the very next version.
I need to parse my Excel sheet based on a keyword search. I mean, I have to search for the keyword โXYZโ and then parse the table below it. This keyword can change its position for each performance.
Since I donโt know the range of cells, I canโt even get Excel data in DataTableusing the above query.
source
share