Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Import Excel data
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Import Excel data
Divers
Thread ID:
01207090
Message ID:
01207090
Vues:
73
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform