[AccessD] Syntax for seeing named range in excel

John Colby jwcolby at ColbyConsulting.com
Thu Jan 19 12:33:21 CST 2006


Gustav,

Which is why you're one of my heroes.

Syntax 2 works, I couldn't get syntax one to work, though now I might be
able to.

The final SQL (after Access rearranged it) was:

"SELECT ['T'].Section, ['T'].DocName, ['T'].EFA, ['T'].PCDT, ['T'].DSL,
['T'].CRF, ['T'].[UseDocNo] FROM [Excel
5.0;DATABASE=X:\DocumentRequestTemplate.xls].SecDocWithHdr AS ['T'];" 

I was wondering what the heck T was for until I saw the rearranged version.

Thanks again.

John W. Colby
www.ColbyConsulting.com 


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Thursday, January 19, 2006 12:44 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Syntax for seeing named range in excel

Hi John

You miss the Excel header. Two options exist:

 SELECT
    NameOfField1,
    NameOfField2
  FROM
    [Range] AS T IN '' [Excel 5.0;DATABASE=c:\windows\temp\some.xls;];

In the second syntax the trick is the brackets. They can be omitted in this
example but are mandatory if you deal with filenames containing spaces.

This should be changed to:

  SELECT
    NameOfFiels1,
    NameOfField2
  FROM
    [Excel 5.0;DATABASE=c:\windows\temp\some.xls;HDR=YES].[Range] AS T;


>>> jwcolby at ColbyConsulting.com 19-01-2006 18:14:42 >>>
Does anyone know the syntax in an SQL statement for seeing a named range in
an excel spreadsheet?

I have a spreadsheet DocumentRequestTemplate.xls, which has a sheet
xlsReqForDocuments which has a named range Sec_DocWithHdr, Sec_DocNoHdr etc.

I assume that the syntax would look something like 

SELECT * from SEC_DocWithHdr IN DocumentRequestTemplate.xls

Doing this gets me "unrecognized database format" however.

Anyone know what the real answer is?

John W. Colby
www.ColbyConsulting.com 


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list