I'm creating a program in Visual C++ and the program I'm creating needs to read a data in an Excel document. It was saved in .xls format.

Can someone help me on how to read data in an Excel file. No need for writing or editing the excel document, just a read function. I found lots of codes on how to manipulate an excel file but it seems too complicated for me since I'm just a noob in C++. Maybe a very simple sample code on how to read from an Excel file.

Recommended Answers

All 5 Replies

It's not as easy as it sounds, since there is alot of information in an xls file, ofcourse there are different versions too. http://sc.openoffice.org/excelfileformat.pdf

Normally when you are a beginner looking at something like this, you would use CSV files, as they are much easier to read etc. Please note, we will not provide code solutions for you, you will need to do some work yourself and show evidence of the fact you have done so.

Chris

Can you show me a very simple example on how to read an excel file saved on a CSV format.

Please note, we will not provide code solutions for you, you will need to do some work yourself and show evidence of the fact you have done so.

It's really not to hard, if you know some basic file handling techniques you can do it no problem.
It can get a bit more advanced but to start with it's simple enough, and I'm sure if you do some research; it would be even easier.

Chris

You can try 3rd party commercial library for this task, for example: http://www.libxl.com. It has an easy interface.

If you want to write to Excel files you can use xlsLib
However I would recommend to use CSV-files (as already mentioned) because they're more C++ friendly and it's just easier to read out the data using some simple file handling techniques ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.