0

I have to read/write the excel file in C++. I searched in net I found may library file which provides the functionality to parse the Excel sheet but those library are not opensource.

Can any one let me know the easiest way to read/write excel file in c++. If you suggest and predefine library then it should be free of cost.

anh5kor
  • 1
  • 1
  • 4
    CSV format can be used if you are creating that excel file your self programmatically. It is a file in which you maintain data with comma separations. http://stackoverflow.com/questions/1120140/how-can-i-read-and-parse-csv-files-in-c No idea if you want to parse fancy excel files. – PRIME Dec 16 '15 at 08:35
  • LibreOffice is coded in C++ and is able to read many Excel files. – Basile Starynkevitch Dec 16 '15 at 09:02

1 Answers1

2

Several routes:

  1. If you're parsing character separated value files, then you can use simple iostreaming.

  2. Develop an XLL. Download the Excel SDK and go from there. The framework example in that SDK is pretty good.

  3. Use the COM interface. For this you'll need something like Microsoft's ATL. Low level COM, though possible, is difficult.

  4. Use Apache POI and a JNI / JNA layer to it.

(4) has the advantage that excel doesn't need to be installed so can run well server-side, but it will require Java. (3) is a learning curve if you haven't used COM in C++ before. Budget 6 months of mental fog.

In the absence of any more information, I'd plump for (2). The XLL interface is extremely good.

Bathsheba
  • 231,907
  • 34
  • 361
  • 483