Move Range of Cells in a Worksheet
Contents
[
Hide
]
This article shows how to move a range of cells in a worksheet.
How to Move Range of Cells in a Worksheet
The example code uses a template file to demonstrate the task.
The input file
Please see the following generated file with range A1:B5 moved to C1:D5.
The output file
Sample Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from aspose.cells import Workbook | |
# Instantiate the workbook object. Open the Excel file | |
workbook = Workbook("book1.xlsx") | |
cells = workbook.worksheets[0].cells | |
range = cells.create_range("A1", "B5") | |
# move the range to right. | |
range.move_to(0, 2) |