Article ID: 130137
Article Last Modified on 2/22/2005
130732 How to Create Data Source to Microsoft Excel Files
handle = SQLCONNECT(<data source>,<username>,<password>) success = SQLTABLES(handle)The cursor created by this code has five fields, the third of which contains the table names. In the case of Microsoft Excel version 5.0, these table names are actually the names of the worksheets within the workbook to which you have connected. They all have a dollar sign ($) as the last character, and you must be sure to include the dollar sign when accessing the worksheet.
handle = SQLCONNECT('Excel 5.0 data source','','')
success = SQLEXEC(handle,'select * from "sheet1$"')
Note that the sheet name is surrounded by double quotation marks, with the
entire select statement inside single quotation marks. This is the required
syntax.
handle = SQLCONNECT('Excel 4.0 data source','','')
success = SQLEXEC(handle,'select * from sheet1')
Note the absence of double quotation marks surrounding the sheet name.
Additional query words: VFoxWin
Keywords: kbhowto kbcode KB130137