合并Excel文件 [英] Merge Excel Files Into One

查看:80
本文介绍了合并Excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几百个Excel文件,其中每个文件在第一张表上都有一些数据。我被要求在C#中编写一个控制台应用程序,将所有Excel文件合并到一个文档中,同时保留格式。



合并文件是一个工作簿包含合并到文档中的每个文件的工作表。不幸的是,Excel文件是二进制而不是XML格式,所以我无法执行XSL转换。



是否有免费的库或示例代码演示了如何将多个Excel文档的表格组合成单个文件?

解决方案

您需要使用Microsoft Excel Interop库。 http://msdn.microsoft.com/en- us / library / microsoft.office.interop.excel.aspx



您应该可以在com选项卡中添加引用到Microsoft Excel 11对象库。



http://msdn.microsoft.com/en-us/library/ms173186(VS.80).aspx


I have a few hundred Excel files, where each file has some data on the first sheet. I've been asked to write a console application in C# which merges all of the Excel files together into a single document while retaining the formatting.

The consolidated file is a single workbook containing a sheet for each file merged into the document. Unfortunately, the Excel files are in binary rather than XML format, so I can't perform an XSL transformation.

Is there are free library or sample code which demonstrates how to combine a sheets from multiple Excel documents into a single file?

解决方案

You'll need to use the Microsoft Excel Interop library. http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.aspx

You should be able to add a reference, in the com tab, to Microsoft Excel 11 Object Library.

http://msdn.microsoft.com/en-us/library/ms173186(VS.80).aspx

这篇关于合并Excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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