使用C ++从Excel文件中提取数据 [英] Extract data from excel file using C++

查看:70
本文介绍了使用C ++从Excel文件中提取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能给我直接简便的方法(当然包括代码和其他必要的库,以便正确执行)将数据从excel文件输入到C ++吗?实际上,我需要输入大量数据以从C ++中的excel输入,最后在用C ++计算时,再次将输出与excel链接.有人可以帮忙吗?

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?

推荐答案

正如其他人所提到的,使用 CSV 文件是最简单的方法,因为可以将其导入Excel或从Excel导出文件.这可能是最有效的解决方案,因为它只需要标准C ++库,并且比使用Excel库要快得多.拥有CSV文件后,可以根据需要在Excel中打开它,并将其转换为真实的" Excel文件.

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.

如果您正在处理 .xlsx 文件,则可以利用以下事实:这些文件只是 XML 文件的28file_format%29"rel =" nofollow noreferrer>压缩集合.可以在此网站上 找到更多信息.您只需要找到一个压缩库和XML库即可.

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.

否则,有一些可用的Excel库,例如 LibXL

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

最后,在 StackOverflow 上有几篇关于这个主题的文章.请参阅以下内容:

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

用于加载Excel(.xls)文件的C ++库

Excel文件和C ++

什么是简单可靠的C库来处理Excel文件?

这篇关于使用C ++从Excel文件中提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆