Link to home
Start Free TrialLog in
Avatar of edrz01
edrz01Flag for United States of America

asked on

How can I link to Excel spreadsheet with space in UNC

How can I link to an Excel spreadsheet where the UNC and file name have spaces in them?
For instance what I am using is this:
EXEC sp_addlinkedserver 'ExcelSource',
   'Jet 4.0',
   'Microsoft.Jet.OLEDB.4.0',
'\\vfs\ab common\123\Other\Server Survey\updated_INFO and Cable Survey Schedule_SJS.xls',
      NULL,
   'Excel 5.0'
GO

It "appears" to link okay but when I query against it I get messages like:
Query - SELECT * FROM OPENQUERY(excelsource, 'SELECT * FROM [Server List]')
------
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "excelsource" returned message "Cannot start your application. The workgroup information file is missing or opened exclusively by another user.".
Msg 7399, Level 16, State 1, Procedure sp_tables_ex, Line 41
The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "excelsource" reported an error. Authentication failed.
Msg 7303, Level 16, State 1, Procedure sp_tables_ex, Line 41
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "excelsource".
ASKER CERTIFIED SOLUTION
Avatar of reb73
reb73
Flag of Ireland 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
Avatar of edrz01

ASKER

Thanks reb73. I just tried that and you are correct - same thing.

Still researching as to why I am getting the errors. I "assumed" it was due to the spaces but no I see it is something else lurking.....
What exactly is '[Server List]' within the Excel sheet? Is it a named range or a sheetname??
Avatar of edrz01

ASKER

Sheetname.

I have also tried another sheet - same thing.

BTW - this is Office 12.

I used this to add it this time:
EXEC sp_addlinkedserver EXCEL,
'Jet 4.0',
'Microsoft.Jet.OLEDB.4.0',
'e:\updated_INFOandCableSurveySchedule_SJS.xls',
NULL,
'Excel 5.0;'

And now when I run EXECUTE SP_TABLES_EX 'excel' I get
TABLE_CAT      TABLE_SCHEM   TABLE_NAME     TABLE_TYPE     REMARKS
(0 row(s) affected)

When I try to query a sheet using this:
select * from excel...[plan$]

I get the error:
Msg 7314, Level 16, State 1, Line 1
The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "excel" does not contain the table "plan$". The table either does not exist or the current user does not have permissions on that table.