Learn how to copypaste columns in C# with this source code sample. ByteScout Spreadsheet SDK: the library (SDK) that is capable of writing, reading, modifying and calculating Excel and CSV spreadsheets. Most popular formulas can be calculated and reculculated with Excel installed. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays. It can copypaste columns in C#.
C# code samples for C# developers help to speed up coding of your application when using ByteScout Spreadsheet SDK. Just copy and paste the code into your C# application’s code and follow the instruction. Code testing will allow the function to be tested and work properly with your data.
You can download free trial version of ByteScout Spreadsheet SDK from our website to see and try many others 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)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using Bytescout.Spreadsheet;
namespace CopyPasteColumns
{
class Program
{
static void Main(string[] args)
{
// Open spreadsheet from file
Spreadsheet document = new Spreadsheet();
document.LoadFromFile(@"example.xls");
//document.LoadFromFile(@"d:\2\1\Bytescout\Spreadsheet SDK\TestCase\Formats.xls");
// Get first worksheet
Worksheet worksheet = document.Workbook.Worksheets[0];
// Copy first two ("A-B") columns to the fourth ("D") column
worksheet.Columns.CopyAndPaste(0, 1, 12);
// Delete output file if exists
if (File.Exists("changed.xls"))
{
File.Delete("changed.xls");
}
// Save document
document.SaveAs("changed.xls");
// Close spreadsheet
document.Close();
// Open generated XLS document in default program
Process.Start("changed.xls");
}
}
}
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: