Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data from Excel
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Miscellaneous
Thread ID:
00258693
Message ID:
00258735
Views:
15
>Ok, I'm pretty frustrated with attempting to IMPORT a large Excel spreadsheet into a table.
>
>[[Side Note: WHY does VFP 6.0 still have "Excel 5.0" as the latest version of Excel in it's list of import types -- Geez!]]
>
>I have tried every way to import all the data from a 62 Column by 75640 Row spreadsheet into a table, including the IMPORT command, the import dialog in VFP, "Save As" from Excel into a .DBF (again OLD DBase versions), and I either only get a little more than 16,000 records or I get all the records, but NOT all the columns. DAMN FRUSTRATING for working with the newest version of VFP and the newest version of Excel.
>
>[[Side Note #2: MY VFP 7.0 "wish list item" ... FIX THIS!!!]]
>
>Anyway, so I guess I have to resort to Automation. I can instantiate Excel and open the file, but can someone tell me how to pull in EVERY row and column which contains data from the spreadsheet into a table.
>
>Thanks.

How's this:

oXL = CREATEOBJECT("Excel.Application")
XLApp.WorkBooks.Open("myBigAssSpreadsheet.xls")
oSheet = oXL.ActiveSheet
lnColumns = 62 && number of fields in sheet
lnRows = 75640 && number of rows
SELECT MyTargetCursor
FOR i = 1 TO lnRows
APPEND BLANK
FOR j = 1 TO lnColumns
luValue = oSheet.Cells(i,j).Value
REPLACE (Fields(j)) WITH luValue
ENDFOR
ENDFOR

This is untested.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform