http://www.c-sharpcorner.com/blogs/7482/retrieving-excel-data-and-binding-to-a-combobox-in-c-sharp.aspx
Iam using the code of above post:
But it gives following error:
1) external table is not in the expected format
I have excel sheet having employee id month and year columns.These three columns i should attached comboboxes.
Please give a solution
Thank you,
SRILATHA
Retrieving Excel Data and Binding to a ComboBox in C#
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Akkiraju IvaturiRank #473 · 5.3K reputationPosted Aug 8, 2012, 6:13 PM EDT
using System.Collections.Generic; using System.Data; using System.Data.OleDb; using System.Windows.Forms; namespace WindowsFormsApplication3 { public partial class Form1 : Form { public Form1() { var path = @"D:\test.xls"; var dt = new DataTable(); dt.Load(LoadData(path, "Sheet1$")); // for test new DataGrid { Parent = this, Dock = DockStyle.Fill, DataSource = dt }; // create and bind combobox; "F3" is a name of the column in the test.xls new ComboBox { Parent = this, Dock = DockStyle.Top, DisplayMember = "F3", DataSource = dt }; } OleDbDataReader LoadData(string path, string sheet) { var cs = "provider=Microsoft.Jet.OLEDB.4.0; Data Source='" + path + "'; Extended Properties=Excel 8.0;"; var c = new OleDbConnection(cs); c.Open(); var cmd = c.CreateCommand(); cmd.CommandText = "select * from [" + sheet + "]"; return cmd.ExecuteReader(CommandBehavior.CloseConnection); } } }