February 16, 2010 at 8:53 pm
Comments posted to this topic are about the item Import Excel Spreadsheet to Database Tables
February 16, 2010 at 11:37 pm
Thanks for your article. Do you also have a solution for sheet xml imports if the sheet name is change randomly or with a certain string?
February 16, 2010 at 11:54 pm
For 32 bit version, here are some methods used to import/export to EXCEL from SQL Server table
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926
Failing to plan is Planning to fail
February 17, 2010 at 12:08 am
I recently came across this problem when we moved from Windows 32bit to Windows 64bit, using SQL 2005/2008 64bit. There are a lot of openrowset/opedatasource for older Excel 2003 xls.
I've finally found a free solution. It seems like Microsoft has replacement Office driver for "Microsoft.Jet.4.0" with its "Microsoft.ACE.OLEDB.12.0".
For 32 bits download the 2007 Office System Driver:Data Connectivity Components
For 64 bits download the 2010 beta (Release June 2010)
Installation of both doesn't require reboot. The 32/64 bits odbc will have the ACE driver for Access/Excel/dbase/cvs/txt after installation and the SQL Provider drivers "Microsoft.ACE.OLEDB.12.0" will be in your 32/64bit SQL Engine.
After installation, in SQL Engine, run the following
USE [master]
GO
EXEC master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess' , 1
GO
EXEC master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'DynamicParameters' , 1
GO
The "Microsoft.ACE.OLEDB.12.0" driver is backward compatible to Excel 2003, so you really can open xls files with this driver.
On a separate note, I've installed Office 2010 beta application, and it did not come with Microsoft.Jet.4.0, so my question is, is Microsoft replacing "Microsoft.Jet.4.0" with "Microsoft.ACE.OLEDB.12.0" on all their future development and slowly phrasing out the jet?
February 17, 2010 at 12:11 am
Great article, do you have a solution for importing a large csv file aswell? I tried your solution but keep on getting the “Invalid Excel worksheet. No data in the worksheet” error.
February 17, 2010 at 12:36 am
For import of csv files i would go for someting like this:
SELECT *
INTO tabelA
FROM OPENROWSET('MSDASQL',
'Driver={Microsoft Text Driver (*.txt; *.csv)};DefaultDir=C:\Data;','select * from tabelB.csv')
February 17, 2010 at 2:34 am
Great article - I'm looking for clues to solve the following problem.
Right now, my scheduled SSIS package (SQL08) to import Excel spreadheet data into SQL 08 works when the Excel spreadsheet is closed. It also works when the spreadsheet is open if I run the job manually from the Import Data wizard.
However, the scheduled SSIS package fails with the 'Jet engine cannot open file' error when the spreadsheet is open.
Is it possible to schedule an SSIS package to import data from an open Excel file to SQL Server?
Many thanks for any tips.
February 17, 2010 at 3:01 am
Jim Cheong (2/17/2010)
I recently came across this problem when we moved from Windows 32bit to Windows 64bit, using SQL 2005/2008 64bit. There are a lot of openrowset/opedatasource for older Excel 2003 xls.I've finally found a free solution. It seems like Microsoft has replacement Office driver for "Microsoft.Jet.4.0" with its "Microsoft.ACE.OLEDB.12.0".
For 32 bits download the 2007 Office System Driver:Data Connectivity Components
For 64 bits download the 2010 beta (Release June 2010)
Useful, thanks Jim
February 17, 2010 at 4:05 am
I wrestled with this for quite awhile. I ended up doing a very manual thing. I blogged about it here
Hope it helps someone.
Rod
February 17, 2010 at 4:06 am
So have you also got a nice bit of TSQL that will parse a directory of 1000s of excel sheets, open them all and save them as xml?
February 17, 2010 at 6:20 am
Great article!
Really good info from Jim Cheong too!
I know I'll be upgrading some old Excel work sooner rather than later, and the current lack of a 64 bit Jet driver has had me wondering what best to do.
Thanks!
February 17, 2010 at 6:21 am
Cannot download your stored procedure - link is broken?
February 17, 2010 at 6:26 am
The link in the article does not work anymore. Please use the links in the "Resources" in the end of the article.
February 17, 2010 at 7:23 am
I tried your code on a WinXP 64-bit workstation connected to SQL Server 2008 64-bit. I always get this error:
Cannot bulk load. The file "C:\TestBook.xml" does not exist. at line 1
Msg 50000, Level 16, State 1, Procedure uspImportExcelSheet, Line 497
Cannot bulk load. The file "C:\TestBook.xml" does not exist.
No matter where I put the "TestBook.xml" file ("C:" or a network drive), it cannot find the file.
Am I missing something?
Denis W. Repke
February 17, 2010 at 7:42 am
When running this script, I get:
SET @WorkSheet=NULL; SELECT @WorkSheet=CAST(BulkColumn as xml) FROM OPENROWSET (BULK 'M:\HTS\Export\currency.xls', SINGLE_BLOB ) A;
XML parsing: line 0, character 0, unrecognized input signature at line 1
Msg 50000, Level 16, State 1, Procedure uspImportExcelSheet, Line 497
XML parsing: line 0, character 0, unrecognized input signature
Tried a few xls files, all gave the same error.
Viewing 15 posts - 1 through 15 (of 69 total)
You must be logged in to reply to this topic. Login to reply