-1

Can anyone provide me a direct and easy way (ofcourse with codes and other necessary libraries to be included for right execution) to input data from excel file to C++? Actually, I need to input a huge amount of data to input from excel in C++ and finally when computed with C++, linking outputs with excel again. Can anyone help please?

Christian Rau
  • 45,360
  • 10
  • 108
  • 185
Tanzila Khan
  • 61
  • 1
  • 1
  • 1
  • 13
    "ofcourse with codes and other necessary libraries to be included for right execution" - > if you pay us of course ;-) – Umut Tabak Oct 06 '11 at 12:10

4 Answers4

7

As others have mentioned, using CSV files is the easiest route, as they can be imported/exported to and from Excel. This would likely be the most effective solution because it would require nothing more than the standard C++ libraries and would likely be much faster than using an Excel library. Once you have the CSV file, you can open it in Excel and convert it to a "real" Excel file if you wish.

If you are dealing with .xlsx files, you can take advantage of the fact that these files are simply zipped collections of XML files. More information can be found at this website. You would just have to find a zipping library and an XML library.

Otherwise, there are a few Excel libraries available, such as LibXL or xlsLib.

Finally, there are several posts on StackOverflow about this very topic. See the following:

C++ library to load Excel (.xls) files

Excel files and C++

What is a simple and reliable C library for working with Excel files?

Community
  • 1
  • 1
user807566
  • 2,828
  • 3
  • 20
  • 27
  • So can you quickly show me how to convert xlsx file into csv file by using codes then convert it back to xlsx? I need to modify xlsx file downloaded from a website for modification. – Zui Zui Aug 04 '23 at 10:25
3

The easiest way is to export data from Excel as CSV and write back to CSV.

hansmaad
  • 18,417
  • 9
  • 53
  • 94
1

Check out these pages on Office Automation.

Bill
  • 14,257
  • 4
  • 43
  • 55
0

For native .xls file OLE XLS from SM Software does a decent job... nothing for free though!

Martin
  • 282
  • 2
  • 6