YESSSSS!
that works. For big sheets this might have the edge over COM.
But I think I'll stick with COM anyway.
But having learned something new is always thrilling for this old brain...
Thanks Boris.
Maybe within a year, I'll visit Sofia then I'll take you for a few beers...
Peter
>>>>(Yes I had used my own filename and folder :-) )
>>>>But:
>>>>
>>>>Sorry I still get a table with the structure in it and a million records with all NULLS
>>>>just like before.
>>>>What am I supposed to get??
>>>>
>>>>
>>>>Peter
>>>
>>>Cursor aaaa must have all columns and rows from Excel sheet.
>>>Strange, it works like a charm here.
>>can you use the file i sent you by email
>>and tell me how to use odbc to get at the data in it. I had never used odbc for that just COM
>
>Strangest thing is that I have an exported from VFP Excel file, opened and Saved in new Excel format and the code I posted works with it. for your file:
>
>lcFile = GETFILE([XLSX])
>IF EMPTY(lcFile)
> RETURN
>ENDIF
>lcFoder = JUSTPATH(lcFile)
>
>TEXT TO lcConnString NOSHOW PRETEXT 15 TEXTMERGE
> DRIVER=Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb);
> UID=admin;
> FIL=excel 12.0;
> DriverId=1046;
> DefaultDir=<<lcFoder >>;
> DBQ=<<lcFile>>
>ENDTEXT
>
>lnSQL = SQLSTRINGCONNECT(lcConnString)
>SQLEXEC(lnSQL,"SELECT * FROM [sheet1$]",[aaaa])
>SQLDISCONNECT(0)
>SELECT aaaa
>BROWSE NORMAL
>
>works, it must give you a cursor Aaaa with the same structure as Excel Sheet1
Peter Cortiel