tags:

views:

59

answers:

2

How do I display, edit and save an Excel sheet data in sql server?

Any help would be appreciated.

+1  A: 

You can use the Microsoft.ACE.OLEDB provider to connect to an Excel sheet using an OLEDB connection. You can then query the Excel sheet directly like you would do a database.

Kirtan
+1  A: 

You can use this connection string for excel 2003:

con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
                filePath + ";Extended Properties=Excel 8.0");

and for Excel 2007, you can use this connection string:

con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                filePath + ";Excel 12.0;HDR=YES");

After if you can execute direct query for excel sheet. You can also take the reference of "Microsoft.Office.Interop.Excel.dll" DLL and use it.

Deepak