ByteScout Spreadsheet SDK – C# – Copy Worksheet

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – C# – Copy Worksheet

ByteScout Spreadsheet SDK – C# – Copy Worksheet

Program.cs

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");
        }
    }
}


  Click here to get your Free Trial version of the SDK

prev
next