ByteScout Spreadsheet SDK - C# - Swap Cells and Their Values - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Spreadsheet SDK – C# – Swap Cells and Their Values

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – C# – Swap Cells and Their Values

swap cells and their values in C# and ByteScout Spreadsheet SDK

How To: tutorial on swap cells and their values in C#

On this page you will learn from code samples for programming in C#. ByteScout Spreadsheet SDK was made to help with swap cells and their values in C#. ByteScout Spreadsheet SDK is the SDK that can write and read, modify and calculate Excel and CSV spreadsheets. Most popular formulas are supported. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays.

Fast application programming interfaces of ByteScout Spreadsheet SDK for C# plus the instruction and the C# code below will help you quickly learn swap cells and their values. Follow the instruction from the scratch to work and copy and paste code for C# into your editor. Enjoy writing a code with ready-to-use sample C# codes to implement swap cells and their values using ByteScout Spreadsheet SDK.

Trial version can be obtained from our website for free. It includes this and other source code samples for C#.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

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 Spreadsheets Spreadsheet document1 = new Spreadsheet(); document1.LoadFromFile("input.xls"); // Get first cell value object value1 = document1.Worksheet(0).Cell("A1").Value; // Get another cell value object value2 = document1.Worksheet(0).Cell("B1").Value; // Swap them object value3; value3 = value2; value2 = value1; value1 = value3; document1.Worksheet(0).Cell("A1").Value = value1; document1.Worksheet(0).Cell("B1").Value = value2; // delete output file if exists already if (File.Exists("Output.xls")){ File.Delete("Output.xls"); } // Save document document1.SaveAs("Output.xls"); // Close Spreadsheet document1.Close(); // open generated XLS document in default program Process.Start("Output.xls"); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page

Explore ByteScout Spreadsheet SDK Documentation

Explore Samples

Sign Up for ByteScout Spreadsheet SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page

Explore ByteScout Spreadsheet SDK Documentation

Explore Samples

Sign Up for ByteScout Spreadsheet SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next