Can anyone provide me a direct and easy way (ofcourse with codes and other necessar开发者_如何学JAVAy 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?
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?
The easiest way is to export data from Excel as CSV and write back to CSV.
Check out these pages on Office Automation.
For native .xls file OLE XLS from SM Software does a decent job... nothing for free though!
精彩评论