Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reading XLSX file without office
Message
From
21/09/2021 17:26:01
 
 
To
21/09/2021 13:58:03
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01682323
Message ID:
01682329
Views:
57
>Hi, I was looking for a way to read an XLSX file, but without having office installed. I looked at the library of Greg Green, which I also use for exporting a cursor to XLSX, but I did not find a way for vice versa. I tried the method OpenXLSXWorkbook, but all created cursors are empty. So not sure if there is a way to accomplish this, or there is another solution?

Greg's class should work fine. It's been a while since I looked at this in detail but some things that might help:

- One time I ran into a name collision. I was already using some cursor or table named something like "Output" and that caused various class methods to fail silently with nothing appearing in cursor(s). Be careful that cursors you use don't conflict with those used in the class

- The class is powerful but a la carte. OpenXLSXWorkBook() returns a handle (ID) to the whole workbook. You can then use GetWorkbookSheets() to get IDs to the sheets in the workbook. Once you've got a sheet ID you can use GetCellValue(). I see there's an OpenXLSXWorkbookSheet() method which might combine the first two steps but I haven't tried it

- ISTR that (maybe in the name of efficiency) some methods don't immediately load data/cursors as one might expect (i.e. "lazy" loading/instantiation). If you're testing with just OpenXLSXWorkbook() and not seeing anything, try getting a worksheet and then a cell value, you may find that actually loads the cursors to process the results you want

- The PDF documentation is fairly good. If you use the Adobe reader I recommend using the Bookmarks mode on the left. You can then navigate to "Methods - Managing Workbooks", "Methods - Managing Sheets", "Methods - Returning Cell Values" etc.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform