read in info from excel spreadsheet

Started by
2 comments, last by Plexmark 19 years, 10 months ago
I tried to find this on the net and search here in the forums. Is it possible to read info from an excel spreadsheet into a c++ program? If you can, could you post a link to an example or post one please. Thanks in advance, Plex
Plexmark-----------------------------If I can help send me a message: ICQ:15998198
Advertisement
Yes. You''d want to look into office automation objects. Since it goes way beyond the scope of a single post to explain them I''ll link you to here [microsoft.com] which is a guide to using the automation objects in Visual C++.

If you have further questions about how to do specific things once you have the appropriate automation object setup (such as how to reorder worksheets, evaluate formulas, insert charts, etc) I''d be happy to help.
If its not real time then save as a CSV and parse manually using common file IO.

Jay
Or you could use ODBC and connect to the excel file as a database and pull data using SQL queries, crazy easy and takes a very small amount of code to do, especially if you use the MFC CDatabase class. You can connect to excel, access, mysql, and likely many others using this method.

[edited by - DrEvil on June 3, 2004 4:46:19 PM]

This topic is closed to new replies.

Advertisement