Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Import Type XLS
Message
From
30/06/2004 10:30:53
 
 
To
29/06/2004 17:14:23
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00918700
Message ID:
00919027
Views:
23
Hi,
I a bit surprised why nobody use ODBC connection to Excel file. Its so easy, and on my opinion its the best way to get result.
And!.. As you wish, the ODBC driver read fieldname from first row, and data begin from second row.
lcConnectionString = "DBQ="+lcExcelFilename+";DefaultDir="+JUSTPATH(lcExcelFilename)+";Driver={Microsoft Excel Driver (*.xls)};DriverId=790;FIL=excel 8.0;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;ReadOnly=1;SafeTransactions=0"

lnHCon = Sqlstringconnect(lcConnectionString)
IF lnHCon>0 && some code skipped
lnSQLTable = SQLTABLES(lnHCon, "'TABLE', 'VIEW', 'SYSTEM TABLE'", '__sqltables')
* Some code skipped again
lcSheet = __sqltables.table_name
lcExec = "SELECT * FROM ["+lcSheet+"]"
lcResultALias = "__mycursor"
lnExecResult = SQLEXEC(lnHCon,lcExec,lcResultAlias)
SQLDISCONNECT(lnHCon)
It might looks a bit complex .. but one time you create own class to read and work with excel files and I sure, you will never use IMPORT anymore...



>Is there a way to programatically import on excel file and tell it the the first name contains field names and begin import on row 2?? You can do it with the wizard but I do not see anything in the import to documentation that helps. I may be going blind as well :)
>
>TIA
>
>Paul
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform