You are here:

C++/opening excel and creating a graph with c++


I have a text file with a list of values that I would like to display as a graph using a simple console application. I have thought of automating Excel using my console application but I'm stuck with then using it to create an Excel graph. Or is there another simple way of opening a graph of my values using a simple c++ console application?

I am sorry but I am confused. Your question’s subject:

   "opening excel and creating a graph with c++"

Implies that you are _only_ interested in using Excel to plot a graph.

Your question however ends up asking:

   "is there another simple way of opening a graph of my
    values using a simple c++ console application? "

Having just complained about having to create a graph in Excel, do you still wish to be using Excel? If so I am afraid that the term simple may not apply as you will have to use the Excel automation interface to do what you wish.

That is _not_ a (standard) C++ topic, it is a Microsoft Excel and Microsoft automation / COM topic. I suggest you refer to the relevant Microsoft documentation to find out about these subjects. Start with the Microsoft Developer Network (MSDN) site at However note that the Office developer documentation is most complete for the current version of Office – that is Office 2007. You might like to perform a search (on the MSDN site or generally on the internet) such as:

   excel C++ automation

The first article listed from an MSDN site search is at and is titled "Office Automation Using Visual C++". It looks like it may be a good starting point (note that some language features it mentions such as #import are non-standard C/C++, being Microsoft Visual C++ specific).

The part which may be purely standard C++ is opening and reading a file, however as you mention that you have an application already I presume you can probably handle this side of things.

If you are using Microsoft Visual C++ then you may like to look at the ATL library and the Office development resources.  


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.