使用c代码将Excel转换为csv [英] Convert Excel to csv using c code

查看:389
本文介绍了使用c代码将Excel转换为csv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用C语言将.xls文件转换为多个csv文件,其中我的数据格式为empid,name,age,sal,depart,grade,并且需要使用代码创建3个文件。它们就像文件1:empid,名称,年龄文件2:empid,sal文件3:empid,离开文件4:等级,工资结构,这应该在一次性批处理模式下完成

how to convert .xls file to multiple csv files using C language where i have data in a format empid,name,age,sal,depart,grade and need to create 3 files using the code . They are like file 1 : empid,name, age file 2: empid, sal file 3: empid,depart file 4: grade, salary structure and this should be done in one shot batch mode

推荐答案

1)安装Excel后,可以在Visual Studio中使用Office-Api并遍历这些行。这意味着所有代码仅适用于具有特定版本Excel的系统。将本机.xls文件格式与自己的C程序一起使用超出了此任务的范围。 - >(最佳开始,当您使用Active-X和COM / OLE时,大多数原生解决方案)



2)您将文件保存在新的XLSX中(基于xml)并创建一个基于遍历所有条目的xml-parser的程序。 - >(最酷的标准解决方案需要花费大部分时间)



3)您已将文件保存在.csv中(Excel可以这样做);然后通过程序进行操作。 - >(对于纯粹的C人来说最实用的解决方案)



4)您购买第三方工具,如Altova Mapforce Enterprise Edition并点击你的程序在一起,然后让工具生成你的xls2csv工具。 - >(最快的解决方案,当你还没有这样的工具时最贵)
1) When you have Excel installed you can use the Office-Api in Visual-Studio and iterate through the lines. This means that all code is only working on systems that have a certain version of Excel. Using the native .xls-file-format with an own C-program is beyond the scope of this task. ->(best start, when you have used Active-X and COM/OLE, most native solution)

2) You save your file in the new XLSX (xml-based) and create a program that is based on an xml-parser going through all entries. ->(most cool "standard" solution that takes most time)

3) You save your file in .csv already (Excel can do that); then go through the lines with a program. ->(Most practicable solution for a pure "C"-person)

4) You buy a third-party tool like "Altova Mapforce Enterprise Edition" and click your program together, then let the tool generate your xls2csv tool. ->(Fastest solution, most expensive when you do not already own such a tool)


这篇关于使用c代码将Excel转换为csv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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