Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Import Excel data
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01207090
Message ID:
01207098
Vues:
26
Arryel,

Check this recent thread Re: Knowing the workbook name Thread #1201694 Message #1201709

If you have Excel installed, then it's easy to get sheet names. Otherwise I'm not sure. I don't know if Michel was able to solve the problem.

>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
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform