darma teja

darma teja

  • NA
  • 496
  • 337.4k

Export only one column from excel into datagrid view

Nov 22 2012 9:55 AM
Hi,

I wanted to export only one colum into datagridview

My code is here:

  OpenFileDialog fdlg = new OpenFileDialog();
            fdlg.Title = "select Excel file";
            fdlg.Filter = "Excel files | *.xls";
            fdlg.FilterIndex = 2;
            fdlg.RestoreDirectory = true;
            if (fdlg.ShowDialog() == DialogResult.OK)
            {
                string filename = fdlg.FileName;


                XLS.Application myapp = new XLS.Application();

                XLS.Workbook wb = myapp.Workbooks.Open(filename);

                XLS.Worksheet sheet = (XLS.Worksheet)wb.Worksheets.get_Item(1);
                

 I am getting problem here


Thanks

Darma

Answers (1)