You are here:

C++/Database in C++ w/ Little Experience


I have a little experience in C++ (I've taken the beginning course in the language offered at my school). I'm trying to write a program for work (I'm not employed as a programmer, it would just make my job easier) and I'm hoping you can point me in the right direction.

I have an excel spreadsheet with over 900 rows of information spread over 8 or 9 columns. I would like to write a program in C++ (because I'm a little familiar with that language) that will allow me to read and write to the spreadsheet, filter data and run reports, which I would write the algorithms for. I would like this program to have a gui.

Basically, in my programming classes, we never talked about or got to reading and writing to an excel spreadsheet, or gui and I was hoping you could tell me which topics within C++ I would need to learn about in order to have the knowledge to write this program (by topic, I mean something that would be easy to search for in a book or online, such as "arrays", "recursive functions" etc).

I realize this is a pretty open question, but if you can point me in the right direction, I'm pretty motivated to learn it. Any free resources online that might deal with this subject that you know about would also be greatly appreciated.

Thank you in advance for your time.

When writing programs that communicate and control with Excel or other applications, you will need to use the facilities provided for you to do so by those who created the application. This has little to do with C++ - you could use C or Visual Basic or some other language providing it can use the provided facilities. The ability to communicate and control one application from another is the job of the Microsoft COM (Common Object Model) and OLE (Object Linking and Embedding) technologies. The specific part of these of interest here is called OLE Automation. OLE/COM uses UNICODE strings, so some understanding UNICODE will be useful (note: the NT based MS Windows operating systems, including Windows 2000 and Windows XP use 16-bit UNICODE character encoding internally).

Likewise when writing GUIs you will need to understand the way MS Windows windows programs work.

The raw MS Windows system APIs (application programming interface) are C APIs, that is they are designed to be callable from C. Hence there are no classes, class or function templates, no function or operator overloading and no class hierarchies to make life easier for the developer. You will therefore need to have a good grasp of the C parts of C++ and the limitations of C with respect to C++. You will need to understand arrays and pointers, and pointers to pointers. C struct and union user defined data types will also feature heavily in the raw C Win32 platform SDK (software development kit) (Win32 is the name for the collection of 32-bit MS Windows operating systems).

As you are planning on using C++ then you can use C++ libraries to help make developing using these Microsoft technologies easier. Two such libraries supplied by Microsoft with their Visual C++ product are the MFC (Microsoft Foundation Classes) and the ATL (Active Template Library). To use these of course you will require a grounding in C++ programming concepts such as classes and objects, class hierarchies, virtual functions, templates (especially where the ATL is concerned), construction a destruction, objects, operator overloading. Note that the MFC and ATL are not the only choices, especially in the area of GUI development.

So in short you are going to require a good understanding of C/C++ to start with and then a lot of specific information on Windows programming and COM/OLE/OLE automation programming, and then specific information on the COM/OLE/OLE automation interfaces defined for Excel and their usage. You will also require a Windows based C++ development tool set (compiler, linker etc.) and the Win32 platform SDK or equivalent header files and libraries to allow the use of Windows system facilities from your application, and of course the similar development resources for Excel.

None of these are small or easy topics and so you are likely to be overwhelmed with all the things you need to know before making a start. On the other hand you might be able to locate some simple examples of doing these sorts of things with Excel to get you started and work up and out from those. If you can then you do not need to know everything all at once, you can progress one piece at a time, learning what you require for each step. I suggest that the more examples you can find to help with understanding the things you need to do the better. You can then lookup anything in examples you do not understand. This will get you a more targeted set of knowledge. What you learn is exactly what you require to complete your task! You can fill in the blanks later if you feel the need. Here is one article on the Microsoft site that might be an interesting starting point. It mainly uses a C subset of C++ as far as I can tell: This also might be of interest but it looks to be somewhat out of date:

A good place to start for Microsoft development information is the MSDN (Microsoft Developer Network) web site at

You can of course easily find many online resources the two I noted above came from a Google search of:

  Excel C++
Hope this is of some help.  


All Answers

Answers by Expert:

Ask Experts


Ralph McArdell


I am a software developer with more than 15 years C++ experience and over 25 years experience developing a wide variety of applications for Windows NT/2000/XP, UNIX, Linux and other platforms. I can help with basic to advanced C++, C (although I do not write just-C much if at all these days so maybe ask in the C section about purely C matters), software development and many platform specific and system development problems.


My career started in the mid 1980s working as a batch process operator for the now defunct Inner London Education Authority, working on Prime mini computers. I then moved into the role of Programmer / Analyst, also on the Primes, then into technical support and finally into the micro computing section, using a variety of 16 and 8 bit machines. Following the demise of the ILEA I worked for a small company, now gone, called Hodos. I worked on a part task train simulator using C and the Intel DVI (Digital Video Interactive) - the hardware based predecessor to Indeo. Other projects included a CGI based train simulator (different goals to the first), and various other projects in C and Visual Basic (er, version 1 that is). When Hodos went into receivership I went freelance and finally managed to start working in C++. I initially had contracts working on train simulators (surprise) and multimedia - I worked on many of the Dorling Kindersley CD-ROM titles and wrote the screensaver games for the Wallace and Gromit Cracking Animator CD. My more recent contracts have been more traditionally IT based, working predominately in C++ on MS Windows NT, 2000. XP, Linux and UN*X. These projects have had wide ranging additional skill sets including system analysis and design, databases and SQL in various guises, C#, client server and remoting, cross porting applications between platforms and various client development processes. I have an interest in the development of the C++ core language and libraries and try to keep up with at least some of the papers on the ISO C++ Standard Committee site at


©2016 All rights reserved.