Copy Excel Range to Worksheet in C#.NET
Tags: copyrange, excel, aspose, csharp
Published: 2018-09-25 07:35:56

---
title: Copy Excel Range to Worksheet in C#.NET
published: true
description: Copy Excel Range to Worksheet in C#.NET
tags: #CopyRange #Excel #Aspose #Csharp
---
Microsoft Excel Range can contain a single cell or multiple cells. It has a start cell and end cell. All the cells that lie within start cell and end cell constitutes a range. Sometimes, user wants to copy a range of cells to some other location inside the same worksheet or to some other location inside the different worksheet.

The purpose of this article is to explain how the C# developers or programmers can use [Aspose.Cells for .NET](https://products.aspose.com/cells/net) in their applications to copy Excel range to same worksheet or different worksheet.

>[Aspose.Cells](https://products.aspose.com/cells/) API supports all .NET frameworks e.g. .NET 2.0, .NET 3.5, .NET 4.0, .NET 7.0, .NET Core, .NET Standard 2.0, Xamarin and can be used to develop both ASP.NET web sites and Windows Forms application. It is also available in other platforms e.g. Java, C++, Android, JavaScript, PHP etc. Besides, [Aspose.Cells is available in Cloud as REST or RESTful APIs](https://products.aspose.cloud/cells).


# Copy Excel Range to Same Worksheet

The following C# sample code loads the sample Excel file inside the Aspose.Cells Workbook object. It then accesses the first worksheet which contains the source Excel range that we want to copy to same worksheet. It then uses the ***Range.Copy()*** method to copy it to new location inside the worksheet.

{% gist https://gist.github.com/AsposeCells/32124b8f045e7808e5978367ace224ab %}

The following [screenshot](https://github.com/AsposeCells/AsposeCells-Screenshots-and-Sample-Files/blob/master/Copy-Excel-Range-to-Worksheet/Excel-Range-copied-to-different-location-inside-the-Same-Worksheet-using-Aspose.Cells-API.png) shows the [sample Excel file used inside the code](https://github.com/AsposeCells/AsposeCells-Screenshots-and-Sample-Files/blob/master/Copy-Excel-Range-to-Worksheet/sampleExcelRange.xlsx) and the [output Excel file generated by the code](https://github.com/AsposeCells/AsposeCells-Screenshots-and-Sample-Files/blob/master/Copy-Excel-Range-to-Worksheet/outputCopyExcelRangeToSameWorksheet.xlsx) for your reference. As you can see inside the screenshot, ***the source Excel range has been copied to the destination Excel range.***

>_**Caption:** Excel Range copied to different location inside the Same Worksheet using Aspose.Cells API_

![Excel Range copied to different location inside the Same Worksheet using Aspose.Cells API](https://raw.githubusercontent.com/AsposeCells/AsposeCells-Screenshots-and-Sample-Files/master/Copy-Excel-Range-to-Worksheet/Excel-Range-copied-to-different-location-inside-the-Same-Worksheet-using-Aspose.Cells-API.png "Excel Range copied to different location inside the Same Worksheet using Aspose.Cells API")

# Copy Excel Range to Different Worksheet

The following C# sample code loads the sample Excel file inside the Aspose.Cells Workbook object. It accesses the first worksheet which contains the source Excel range and the second worksheet where source range is to be copied. It then copies source range of first worksheet into destination range inside second worksheet using the _**Range.Copy()**_ method.

{% gist https://gist.github.com/AsposeCells/a541c2550c9fa76c8a1d7f175cecbeff %}

The following [screenshot](https://github.com/AsposeCells/AsposeCells-Screenshots-and-Sample-Files/blob/master/Copy-Excel-Range-to-Worksheet/Excel-Range-copied-to-Different-Worksheet-using-Aspose.Cells-API.png) shows the [sample Excel file used inside the code](https://github.com/AsposeCells/AsposeCells-Screenshots-and-Sample-Files/blob/master/Copy-Excel-Range-to-Worksheet/sampleExcelRange.xlsx) and the [output Excel file generated by the code](https://github.com/AsposeCells/AsposeCells-Screenshots-and-Sample-Files/blob/master/Copy-Excel-Range-to-Worksheet/outputCopyExcelRangeToDifferentWorksheet.xlsx) for your reference. As you can see inside the screenshot, _**the source Excel range has been copied to the destination Excel range in different worksheet.**_

>_**Caption:** Excel Range copied to Different Worksheet using Aspose.Cells API_

![Excel Range copied to Different Worksheet using Aspose.Cells API](https://raw.githubusercontent.com/AsposeCells/AsposeCells-Screenshots-and-Sample-Files/master/Copy-Excel-Range-to-Worksheet/Excel-Range-copied-to-Different-Worksheet-using-Aspose.Cells-API.png "Excel Range copied to Different Worksheet using Aspose.Cells API")

# See also

* [Copy Excel Range to Worksheet in Java](https://dev.to/asposecells/copy-excel-range-to-worksheet-in-java-648)
* [Copy Range Data with Style](https://docs.aspose.com/display/cellsnet/Copy+Range+Data+with+Style)
* [Copy Range Data Only](https://docs.aspose.com/display/cellsnet/Copy+Range+Data+Only)
* [Forum -  Aspose.Cells Product Family](https://forums.aspose.com/c/cells)