C# - how do I copy Excel Worksheet from one Workbook to another?

Posted on 2010-01-08
Last Modified: 2013-12-17
Hi all-

Does anyone have C# code that copies an Excel worksheet from one workbook to another?  I'm using Office 2003 and Visual Studio 2005.  I have VSTO 2005 SE installed and am interested in using the Microsoft.Office.Tools.Excel object instead of the convoluted Excel Interop object.  I've been trying to get some VBA examples that I see on the 'net to work (obviously not using VSTO), but can't get that to work, nor anything I try with VSTO.

Thanks much!
Question by:DaveScan1
    LVL 35

    Expert Comment

    by:Miguel Oz

    This code is 2008, but it will work for you as the code uses the same method signatures(Office 2003/2007 are the same in this area, just make sure to include the appropiate reference Microsoft.Office.Tools.Excel (11))

    Translate this code to C# is very easy, I can do it if you like
    LVL 35

    Accepted Solution

    The comment is self explanatory and provide the correct answer.
    The C# code translation of my answer is available here:


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
    The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
    Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now