Home   Archive   Permalink



How to get sheet name from excel file?

Hi, I can connect to an excel file using the following code:
    
p: open [
     scheme: 'ODBC
     target: "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=c:\test.xls"
]
conn: first p
insert conn "select * from [Sheet1$]"
result: copy conn
    
But what if I don't know the sheet name (Sheet1)? I know there are some ways in ADO or .NET or using excel object etc. But is it possible to get it using SQL?
(I posted this as a separate question because people may don't look the my other post as it looks already answered)


posted by:   Endo     29-Jun-2010/7:21:24-7:00



Well, ok, I did it as mentioned in SDK docs.
    
insert p ['tables]
r: copy p ;gives useful informations
third first r ;gives the name of the first sheet
>> "Sheet1$"

posted by:   Endo     29-Jun-2010/8:01:35-7:00