Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Import data fromExcel (multiple sheets)
Message
 
À
12/04/2006 04:36:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01112782
Message ID:
01112784
Vues:
21
This message has been marked as the solution to the initial question of the thread.
>Hi All
>
>I know this has all been asked before but as usual I'm looking for some fast pointers to get the ball rolling quickly :) I have an Excel spredsheet. it has four pages/tabs. I wish to extract all the data on each page and dump all cells into a DBF file, one DBF file per page/tab. Any quick ideas to get going?
>
>Thanks

One way:
#define xlDBF4 11
LOCAL oExcel AS Excel.Application, lcDBFName
oExcel = CREATEOBJECT([Excel.Application])
oExcel.WorkBooks.Open([MyXLS.xls])
oExcel.DisplayAlerts = .f.
FOR EACH oSheet IN oExcel.ActiveWorkBook.Sheets
    oSheet.Activate
    oExcel.Range([A1]).Select
    oSheet.SaveAs(oSheet.name,xlDBF4)
NEXT
oExcel.ActiveWorkBook.Close()
oExcel.Quit()
oExcel = NULL
Of course if you know the exact sheet names and the Exact Sheet counts you could always do:
IMPORT FROM MyXls XL5 SHEET Sheet1 (real name of the sheet here)
IMPORT FROM MyXls XL5 SHEET Sheet2
etc.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform