Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2006, 04:03 AM
Registered User
 
Join Date: Aug 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default consolidation of xls problem

hi friends i need to consolidate some xls files data in to one new xls, any body can help me how to do this in c#.net?

 
Old July 24th, 2013, 05:22 AM
Registered User
 
Join Date: Jul 2013
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, here is how you can create XLS file in .NET from multiple XLS files:
Code:
string[] filePaths = { "C:\\Book1.xls", "C:\\Book2.xls", "C:\\Book3.xls" };
ExcelFile newFile = new ExcelFile();

foreach (string path in filePaths)
{
    ExcelFile temp = ExcelFile.Load(path);
    foreach (ExcelWorksheet sheet in temp.Worksheets)
        newFile.Worksheets.AddCopy(sheet.Name, sheet);
}

newFile.Save("C:\\New Book.xls");
I used this .NET Excel component.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading xls file balesh.mind ASP.NET 2.0 Professional 1 August 27th, 2007 11:54 PM
Excel Consolidation ! sriramus Access VBA 1 February 28th, 2006 08:33 AM
consolidation thelos Excel VBA 0 September 5th, 2005 05:35 AM
.mpp to .xls sachin-csharp .NET Framework 2.0 0 November 1st, 2004 12:25 AM
problem openning huge xls file helmekki Excel VBA 3 October 5th, 2004 04:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.