0

i have an Excel sheet with (for example) 5 columns and 15 rows. all these columns and rows are filled with some data.Now i want to get all the 5 columns data in the 1st row of my Excel sheet, So that i can iterate through each one of them and display on my UI . How to get it?

Thanks in advance.

IsmailBaig
  • 87
  • 1
  • 1
  • 7

3 Answers3

0

One very simple option is using the Excel spreadsheet as an OLE DB data source. You can find the connection strings at:

Excel (.xls): http://www.connectionstrings.com/excel

Excel 2007 (.xslx): http://www.connectionstrings.com/excel-2007

M.Babcock
  • 18,753
  • 6
  • 54
  • 84
  • due to some reason am not using OLE DB.So, if there is any alternative, plz let me know – IsmailBaig Dec 14 '11 at 05:49
  • Refer to Robotik's answer. Koogra appears to be a good free solution: http://sourceforge.net/projects/koogra/. Otherwise you can use COM interop of the native COM libraries provided by Microsoft. – M.Babcock Dec 14 '11 at 05:52
0

Your can read Excel as a oledb datasource. The First Row is title, your may get it form Datatable or Datareader. The rest rows is data in or Datatable or Datareader.

Whitesmell
  • 204
  • 2
  • 13
0

you can use C# Excel Interop.

Microsoft.Office.Interop.Excel class gives you enough flexibility to load and do anything with the data.

refer http://www.dotnetperls.com/excel

neo
  • 425
  • 3
  • 11