Showing posts with label spreadsheet. Show all posts
Showing posts with label spreadsheet. Show all posts

Friday, February 17, 2012

error help?

I created a linked server to access information in an excel spreadsheet
by using this code:

exec sp_addlinkedserver N'LINKEXCEL_OL',
@.srvproduct = N'',
@.provider = N'Microsoft.Jet.OLEDB.4.0',
@.datasrc = N'C:\dt.xls',
@.provstr = N'Excel 8.0;'

I created a login using this code:

EXEC sp_addlinkedsrvlogin 'LINKEXCEL_OL', 'false'

and I tried to run a query using this code:

select * from openquery(LINKEXCEL_OL, 'select * from [Sheet1$]')

Everything is ok until the select when I get this very descriptive error(sarcasm):

OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. The provider did not give any information about the error.
OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize::Initialize returned 0x80004005: The provider did not give any information about the error.].

Does anyone have any suggestions? I am very lost and do nto see why this wouldn't work..May check this KBA (http://support.microsoft.com/default.aspx?scid=KB;en-us;Q314530%20.).

error help

I am trying to select data from an excel spreadsheet.. so i use

select *
FROM OpenRowSet('MSDASQL','Driver=Microsoft Excel Driver (*.xls); DBQ=c:dt.xls', 'SELECT * FROM [Sheet1$] ' )

and the error i got is

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' reported an error.
[OLE/DB provider returned message: [Microsoft][ODBC Excel Driver] The Microsoft Jet database engine could not find the object 'Sheet1$'. Make sure the object exists and that you spell its name and the path name correctly.]
OLE DB error trace [OLE/DB Provider 'MSDASQL' IColumnsInfo::GetColumnsInfo returned 0x80004005: ].

any suggestions?Not too sure about the syntax here, so I could be blowing smoke. Apologies, if I am.

If the spreadsheet is named dt.xls, should it be DBQ=C:\dt.xls?

If that is not it, then I would check to see that Sheet1 is in the spreadsheet, and make sure no one has gone and renamed it.

Hope this helps.|||Originally posted by MCrowley
Not too sure about the syntax here, so I could be blowing smoke. Apologies, if I am.

If the spreadsheet is named dt.xls, should it be DBQ=C:\dt.xls?

If that is not it, then I would check to see that Sheet1 is in the spreadsheet, and make sure no one has gone and renamed it.

Hope this helps.

Fixed the syntax, and checked sheet1 was there,but still no good, any other suggestions?