Reading from XLS

WildW

Senior member
Oct 3, 2008
986
20
81
evilpicard.com
Hi folks,

Does anyone know of a free and ready-made way of reading an MS Excel .xls file? I've looked at Microsoft's terrifying 350 page specification of the xls file format and concluded that writing one from scratch is non-trivial. Ideally there would be a library I can pull into my existing C++ program.

So far a quick Google has revealed the existance of a paid-for library to do just this, but free is better. I figure if OpenOffice can open an xls file then there may well be something open-source.

Alternatively, is there maybe some kind of shortcut using something VB-Scripty that would open an xls file and convert it to plain text values so long as Excel/Office is installed?
 

GaryJohnson

Senior member
Jun 2, 2006
940
0
0
If you could use an .XLSX file from Office 2007 or 2010, then those files are just zip files full of xml files. Which should be much easier to parse than whatever ungodly thing is inside of the old .XLS file format.
 

BoberFett

Lifer
Oct 9, 1999
37,563
9
81
What are you trying to do with the file? What kind of environment, does the computer have Excel installed? You can open a file using Excel itself and then control Excel from another program.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,284
3,905
75
I'm bullish that there might be.

Though CSV is generally a better option.
 

WildW

Senior member
Oct 3, 2008
986
20
81
evilpicard.com
Unfortunately I have to open the output file from some other program, which is not Excel but does output XLS format. . . don't ask. I need to extract one of the sheets within it to get the columns of numbers therein.

I'll take a look at libole2, and I've found something promising at http://www.falcoware.com/ that looks to be a free library to do the job.
 

Kr@n

Member
Feb 25, 2010
44
0
0
If you just need to read the data in the XLSs, I think you can use the Microsoft Jet Engine with an Excel provider (IIRC, there is a standalone provider). The is some caveats with this method (for example : only the first 8 lines are used to determine if the string columns are varchar(255) or text, so you have to be extra careful for these cases.)
 

WildW

Senior member
Oct 3, 2008
986
20
81
evilpicard.com
I had a play with a XLS loading library today but it died when shown a complex file. I've used a Visual Basic script in the end to convert the XLS to csv by dragging and dropping the file onto it - it will make things a two step process, but it will work.
 

bobross419

Golden Member
Oct 25, 2007
1,981
1
0
Pretty easy in perl with Spreadsheet:arseExcel to get the values of (a) specific column(s).

You can then turn around and use Spreadsheet::WriteExcel then you can just open it directly in Excel. Even easier would be to just write it to a CSV format and import that into Excel.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |