954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to Read Excel File

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.

everard
Newbie Poster
21 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

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

Freaky_Chris
Master Poster
702 posts since Apr 2008
Reputation Points: 325
Solved Threads: 118
 

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

everard
Newbie Poster
21 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 
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

Freaky_Chris
Master Poster
702 posts since Apr 2008
Reputation Points: 325
Solved Threads: 118
 

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

dmytro
Newbie Poster
6 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

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 ...

tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You