Hi,
Can anyone tell me how to read the content of an excel file without looping through each cell of the excel file.
The main thing is that I should avoid looping through each cell for reading the content of the excel file.
Thanks & Regards,
Ramana
Read Excel file in C# without looping through each Cell
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Apr 19, 2011, 1:30 AM EDT
You can read the excel file and display data in datagrid string strConn; strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=C:\\exceltest.xls;" + "Extended Properties=Excel 8.0;"; //You must use the $ after the object you reference in the spreadsheet OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [Tabelle1$]", strConn); DataSet myDataSet = new DataSet(); myCommand.Fill(myDataSet, "ExcelInfo"); DataGrid1.DataSource = myDataSet.Tables["ExcelInfo"].DefaultView; DataGrid1.DataBind();Sam HobbsRank #107 · 20.5K reputationPosted Apr 19, 2011, 1:24 PM EDT