Tag Archives: C

Inputting and outputting to Excel XLSX/XLS using the LibXL library

I needed a way to input from and output to Excel .xlsx and .xls file in my data wrangling software, Easy Data Transform. I had previously used Qt’s ActiveQt classes to talk to Excel via ActiveX, in my seating planner software, PerfectTablePlan. But this came with distinct limitations:

  • Excel must be installed on the customer computer.
  • ActiveQt only works on Windows.

I wanted to be able to read and write Excel file on Windows and Mac from my C++/Qt application, whether Excel is installed or not. I would rather commit suicide with a cheese grater, than try to write my own code to parse whatever horrific format Excel is written in. So I looked around for a library.

I ended up buying a licence for LibXL, from XLWare, back in 2019. It has been working great ever since. I now also use it in PerfectTablePlan v7.

Things to like:

  • Available as a library for Windows, Mac, Linux and iOS (I have only used it for Windows and Mac, so far).
  • Accessible from lots of languages, including: C, C++, .Net, Delphi, PHP, Python, PowerBASIC and Fortran.
  • Example code is available in C++, C, C# and Delphi.
  • Good support.
  • Regular updates.
  • Reasonable pricing.
  • No per-user fees.

The API is a little low-level for my taste, but I guess that is inevitable when you support C as well as C++. Reading and writing is slow compared to reading and writing the same data to/from a CSV file. But, no doubt, that is due to the limitations of the Excel file format.

I don’t have any affiliation with LibXL beyond being a paying customer, and I haven’t been asked to write this. I just wanted to give a shout-out to the developer, Dmytro, for his sterling work. Long may it continue.