Home » excel » c# – Populate ComboBox and Textfields from Excel

c# – Populate ComboBox and Textfields from Excel

Posted by: admin April 23, 2020 Leave a comment


I have an excel spreadsheet, that contains client information. I would like to populate a combo box (comboBox1) with unique values from Column A. I would then like a second combo box (comboBox2) to list the values from Column B that exist where comboBox1=Column A. Finally, I would like to populate text fields with column’s C, D, E and so on….

I have mocked up a quick screen of my desired result:

enter image description here

This would be derived from the following spreadsheet:

enter image description here

The data in the spreadsheet changes from time to time, which is why I can not hard code the information.

I am not sure where to even start with this. Do I load the data into 2D arrays or is there a better way of doing it?

How to&Answers:

You have at least a few options.


If the excel file is a 2007 format (xlsx) or up, then you can work with it programatically via the OOXml SDK provided by Microsoft.

Have a look at the following How-To:

How to: Retrieve the Values of Cells in a Spreadsheet Document

For other How-To’s for spreadsheets:



You can automate excel and interact with it programmatically. This requires excel to be installed on the computer the program is running from. Microsoft also cautions that this is not supported on server environments.

There are many questions on SO about excel interop via C#.


Excel Drivers

MS provides excel ODBC and OLEDB drivers.