Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Import data fromExcel (multiple sheets)
Message
 
To
12/04/2006 04:36:32
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01112782
Message ID:
01112784
Views:
22
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform