I have been trying following to Export Data to SQL Table from Excel sheet and both are giving me errors. Excel sheet exists and the path is correct as well.
Since the second option didn't work, have been trying the first option by saving the excel file as .xls.
I would like to get this done through the script instead of DTS or using the wizard, appreciate your help and the question is "the table name (MyTable ) I have specified in the Select should be created before I run this?
I am using excel 2007 and SQL 2005
1. SELECT * INTO MyTable FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Reports\Data.xls', 'SELECT * FROM [Items$]')
Error for above script
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "The Microsoft Jet database engine could not find the object 'Items$'. Make sure the object exists and that you spell its name and the path name correctly.".
Msg 7350, Level 16, State 2, Line 1
Cannot get the column information from OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".
2. SELECT * INTO MyTable FROM OPENROWSET('Microsoft.Jet.OLEDB.12.0', 'Excel 12.0;Database=C:\Reports\Data.xlsx', 'SELECT * FROM [Items$]')
Msg 7403, Level 16, State 1, Line 1
The OLE DB provider "Microsoft.Jet.OLEDB.12.0" has not been registered.
Thanks in advance.