I figured it out, it was the connection string. In the query, I needed brackets around the sheet name and added the $. Now, if I can get it to bring in the column names correctly instead of as a record.
Code:
FOR x=1 TO ALEN(aSheets,1)
lsConnstr = [Driver=] + ;
[{Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};] + ;
[DBQ=] + lsXLBook
lnSQLHand = SQLSTRINGCONNECT( lsConnstr )
lsSQLCmd = "Select * FROM ["+aSheets[x]+"$]"
lnSuccess = SQLEXEC( lnSQLHand, lsSQLCmd, [xlResults]+TRANSFORM(x) )
ENDFOR
SELECT ("xlResults"+TRANSFORM(x))
BROWSE NOWAIT
>Whar ODBC error do you get?
>
>>I have tried, I get a handle but the query fails. I think the sqlexe does not like the name "Sheet1$" or the real sheet name (all the sheets are named) in the query string. I cannot successfully execute the query. I get a handle, so the connStr is good. Any ideas?
>>
>>>Check
Importing data from a Microsoft Excel 2007 workbook using Visual FoxPro 9.0
Extreme Programming = Plan -> Design -> Code -> Test