Copy Worksheet | C#Bytescout Spreadsheet SDK

Copy Worksheet | C#

Program.cs:

C#
using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.Spreadsheet;
using System.Diagnostics;
using System.IO;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Open existing Spreadsheet
            Spreadsheet document = new Spreadsheet();
    document.LoadFromFile("input.xls");

            // Create copy of worksheet
            document.Workbook.Worksheets.Copy(0, 1, "Copy of Sheet1");

            // delete output file if exists already
            if (File.Exists("Output.xls")){
                File.Delete("Output.xls");
            }

            // Save document
            document.SaveAs("Output.xls");

            // Close document
            document.Close();

            // Open document in default xls viewer
            Process.Start("Output.xls");
        }
    }
}