Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Import Excel data
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Import Excel data
Miscellaneous
Thread ID:
01207090
Message ID:
01207090
Views:
75
Hi,

Working on an Excel data extraction project. The Excel worksheet may have several sheets that all need to read data from.

I've gotten to the the point where I need to know the sheet names to be used for the select statement for the InitRecordset.

Here is my sample code:
LOCAL oXLSConnect, oRecXLS, oXLSRS
oXLSConnect = CREATEOBJECT('adodb.connection')
oXLSConnect.cConnectionString = [Provider=Microsoft.Jet.OLEDB.4.0;Data Source=] ;
	+ GETFILE() + [;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";]
oXLSConnect.Open

oRecXLS = CREATEOBJECT('veRecHandler')   && veRecHandler is an internal class we have
lcSqlCmd = "select * from [" + TRIM(sheet_name) + "]"
oXLSRS = oRecXLS.InitRecordSet(adUseClient, adOpenStatic, adLockOptimistic, lcSqlCmd, oXLSConnect)
oRecXLS.Rs2Cusror(oXLSRS, "C_" + TRIM(table_name))
Any help is greatly appreciated.

Regards,
Ariel
Speak using soft and sweet words in case you have to eat them later.
Next
Reply
Map
View

Click here to load this message in the networking platform