Import Excel file into DataGridView

Import Excel file into DataGridView using C#
string connectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 8.0;HDR=YES;IMEX=1;""", txtPath.Text);
string query = String.Format("select * from [{0}$]", "Sheet1");
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, connectionString);
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet);
dataGridView1.DataSource = dataSet.Tables[0];
Download Source
Tags: import excel to datagridview in c#, import photo into wave file, Import Data from Excel to DataGridView in C#, import excel to datagridview, how to import excel file to datagridview in c#, c# excel to datagridview, import excel to datagridview c#, excel to datagridview c#, how to import data from excel to datagridview in c#, c# excel datagridview
Related posts:
- Import CSV file into DataGridView
- Export DataGridView to Excel
- Export DataGridView to XML using C#
- Export Data from DataGridView to CSV file
- Export GridView to Excel in ASP.NET
Thanks for
Import Excel file into DataGridView this code help me
this code helded me in importing excel xlsx file into datagrid but there is a problem, its ordering is different when it imports to data grid….
anyone can tell me how i can import it in its original order???
Hi guys! any idea how to save back the data in the datagridview back to the excel file??
thank you!!!!very nice and easy!!!
Thanks Dear i was looking this its save my time
I can load the data but shows me an ” The ‘Microsoft.ACE.OLEDB.12.0′ provider is not registered on the local machine.” on dataAdapter.Fill(dataSet); …… InvalidOperation Exception was unhandled
Please help out soon.