How to load excel file data into datagrid.
This code snippet shows you how to open an excel formatted file and then read the contents of the file into Dataset and then to DataGrid.
System.Data.OleDb.OleDbConnection class opens the specified excel file.
System.Data.OleDb.OleDbDataAdapter class fills the Dataset.
Note: The excel file whose contents are to be read must be closed else exception would be generated.