Read data from Excel spreadsheet range

Jun 9 2012 8:50 AM
Hi All,

I got below issue.

Basically i want to read data in a cell range Ex:A1 to D1 of a spreadsheet(MS Excel). I want to get this range (ex:-A1-D1) from the user and read data comes under that range.

simply something like below;
user click on a button, browse the path to file(.xls or .xlsx or.csv), then insert the range (in 2 text boxes)
Then read data in that range.(# of rows can be differ)
So the program must read data starting from specified Row(A3) to until the end of actual data row(Ex:A10).
And then i should be able to access data by row and by cell in a loop like below;

foreach ( row )
 foreach (column)
  string colData={column data}

Can anybody please give me a hand to solve this. Actually I dont have any idea about reading data from a excel.
If you can drop a sample code for the whole scenario then it's better.

I'm using VS2010,C#.net 3.5

Thanks in Advance,
Max



Answers (1)