Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

Excel 2007 openquery

I have a file in my C:\temp folder
File name is Test.xlsx

I'm trying to do an openquery on the file...see attached code

I installed the engine and I turned on the Ad Hoc Distributed queries with

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO

When I run my attached code I get this error message

Msg 7302, Level 16, State 1, Line 1
Cannot create an instance of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
select * FROM OPENROWSET ( 
  'Microsoft.ACE.OLEDB.12.0' , 
  'Excel 12.0;Database=C:\temp\Test2.xlsx;HDR=YES' , 
  'SELECT * FROM [Sheet1$]' )

Open in new window

Avatar of cb1393
cb1393
Flag of United States of America image

According to your query, SQL Server is looking for a linked server named "Microsoft.ACE.OLEDB.12.0". Have you created a link server connection to the Excel file? If so, try using the name of the link instance name without the single quotes.
ASKER CERTIFIED SOLUTION
Avatar of cb1393
cb1393
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
To clarify my comment above, the linked server connection I was referring to was to an Excel 2007 workbook.
Avatar of Larry Brister

ASKER

Agreed...throwing this over the side.

Look for next question in a moment