ByteScout Spreadsheet SDK – C# – Rename Worksheet

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

ByteScout Spreadsheet SDK – C# – Rename Worksheet

Program.cs

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


namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create new Spreadsheet
            Spreadsheet document = new Spreadsheet();
            document.LoadFromFile("Data.xls");

            // Get worksheet by name
            Worksheet worksheet = document.Workbook.Worksheets.ByName("Sheet1");

            // Set new worksheet name
            worksheet.Name = "Collected Data Sheet";

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

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

            // Close Spreadsheet
            document.Close();

            // open generated XLS document in default program
            Process.Start("Output.xls");
        }
    }
}


  Click here to get your Free Trial version of the SDK

prev
next