Extract data from excel file using C++ [closed]

北战南征 提交于 2021-02-08 12:09:22

问题


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?


回答1:


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?




回答2:


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




回答3:


Check out these pages on Office Automation.




回答4:


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



来源:https://stackoverflow.com/questions/7673926/extract-data-from-excel-file-using-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!