How to read data from an Excel spreadsheet?

In the project in which I work, the client at the last moment asked that I add functionality to import data from an Excel spreadsheet. The examples that he sent me have the extension .xlsx, so I assume they are from Excel 2010, but I would like to support all versions, if possible. Is there a quick and easy way to open and read data from an Excel spreadsheet from C program?

The only idea I can think of is to connect to the spreadsheet as if it were a database, and SELECT the information I need. Is this a good approach? How to connect to Excel spreadsheet via C? I would like to use the Windows API as much as possible.

+2
source share
2 answers

You can use the OLE Automation function to start Excel and let it read the file four times.

See examples here:

http://en.wikipedia.org/wiki/OLE_Automation

+2
source

You can connect to an Excel workbook through the ODBC driver. Control panel | Administrative Tools | Data Sources (ODBC)

+2
source

All Articles