This is a migrated thread and some comments may be shown as answers.

How to read the excel file that was created by grid.MasterTableView.ExportToExcel()?

2 Answers 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sabarishbabu
Top achievements
Rank 1
sabarishbabu asked on 19 Jul 2010, 12:08 PM
Hi,
I would like to Import excel data into the RadGrid.
1. Export the grid into Excel file using Telerik export options (grid.MasterTableView.ExportToExcel())
2. User can update the Excel file and import the excel data to into the Grid using (oleDB connection)
3. I am getting error while  reading the data from excel file to data set like (External table is not in the expected format)
           xConnStr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + path + ";Extended Properties=\"Excel 8.0;HDR=YES;\"";
           string strCom = " SELECT * FROM [" + sheetName + "$] ";
            DataSet sourceDataSet = new DataSet();
            OleDbConnection conn = new OleDbConnection(xConnStr);
            OleDbDataAdapter adapter = new OleDbDataAdapter();
            adapter.SelectCommand = new OleDbCommand(strCom, conn);
            adapter.Fill(sourceDataSet);
            conn.Close();

4. Any idea let me know ?

How to read the excel file that was created by  grid.MasterTableView.ExportToExcel()?

Thanks,
Sabarish.


2 Answers, 1 is accepted

Sort by
0
sabarishbabu
Top achievements
Rank 1
answered on 20 Jul 2010, 01:20 PM
Hi,

Any update on this post?

Thanks
Sabarish
0
Daniel
Telerik team
answered on 20 Jul 2010, 09:27 PM
Hello Sabarishbabu,

Unfortunately it is not possible to use this approach with XML/HTML-based Excel formats - this will work with the binary (BIFF) format only.

You could try to use third-party export library like NPOI:
Export to Excel with third-party library (NPOI)

Best regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
sabarishbabu
Top achievements
Rank 1
Answers by
sabarishbabu
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or