To read an Excel file you have to bear in mind that you can find two different formats:
- new format (2007 onwards).
- old format (until 2003).
The new format (XLSX extension) is a compressed file with several XML in it (try to open an XLSX with a compressor). The old format, on the other hand, is a binary format.
This detail may or may not be important ... you do not specify it in your question, so I leave it for you just in case.
To read an Excel from Qt you have several options at your fingertips:
By hand
If you work on the routine to decompress the XLSX file and dedicate some time to the format you will see that accessing the data you need can be as simple as reading an XML from Qt (with DOM, at a low level, ... more you like).
ODBC
You can use the excel book as if it were a database. In this way, reading information is as simple (or complicated) as launching the relevant SQL query.
In order to use ODBC, you must have installed the Access database engine. Given the possibilities offered by this option, I will not elaborate much more ... there are many examples on the Internet.
Use third-party libraries
Apart from the already mentioned libXL
, another good candidate is (since you're with Qt), QtXlsx . This library, being designed with Qt as a base, should integrate fairly well into your project.