Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Export data to Excel
Message
De
10/05/2001 07:24:10
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00504835
Message ID:
00505660
Vues:
23
>>>Consequently, using automation, it took me 80 seconds to send 5000 rows by 4 columns of data to Excel 2000. Using VFP6 SP4 on a Dell 933mHz, 256MB RAM.
>>>
>>Mark,
>>Is this cell-by-cell ? Otherwise on noname Athlon 650Mhz, 192Mb RAM it takes 1.1 secs.
>>Cetin
>
>Yes it was cell by cell. Is there a better way?

Hi Mark,
Fortunately there are better ways :)
The less the VBA calling the better the performance.
1)The fastest I know is to save to a fox2x table or CSV or delimited with tab and open that file in excel.
2)Save to a file delimited with tab, _cliptext=FileToStr(Saved), paste to special position in excel
3)From Excel create an ODBC connection (QueryTables) to a database table or free table, or import text file (again QueryTables). This one is about 50-60% slower then paste method (and it's about 4-6 times slower than 1st) but provides a way to directly update,refresh data.

Other options like datatoclip() and paste but be carefull with this one. Not only slower, adds an extra column and even 3rd parameter is specified as 3 doesn't always produce tab delimited format.

1.1 secs was with option 1 :) Full code demonstrating getting 200K rows into excel with 2 different approaches was referenced at some branch (possibly in my first reply). If not I'll find it again.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform