# Manipulate Range Selections

> Copy a sheet from one Excel workbook into a new workbook and delete a range of rows using the Copy Sheet and Delete Range activities.

Using this example you can copy an entire sheet from one workbook, copy it into a new workbook and alter its content by deleting a range of rows.

The example below explains how to work with activities like [Copy Sheet](https://docs.uipath.com/activities/other/latest/productivity/excel-copy-sheet) and [Delete Range](https://docs.uipath.com/activities/other/latest/productivity/excel-delete-range). You can find these activities in the **UiPath.Excel.Activities** package.

This is how the automation process can be built:

1. Open Studio and create a new **Process** named by default **Main**.
2. Drag a **Sequence** container in the **Workflow Designer**.
:::note
Make sure to have the `.xlsx` file inside the project folder. You can use your own `.xlsx` file or download the example we have provided at the bottom of this page. The `.xlsx` file is used for retrieving and processing data to generate a new database.
:::
3. Add an **Excel Application Scope** inside the sequence container.
   * In the **Properties** panel, add the path of the `.xlsx` file, in this case `example.xls`, in the **WorkbookPath** field.
   * Select the check boxes for the **AutoSave**, **CreateNewFile** and **Visible** options. The robot is now allowed to create a new Excel workbook, to automatically save all the changes made to it and to open the Excel file in the foreground while performing actions on it.
4. Select the **Do** container from inside the **Excel Application Scope** and create the following variables:

   | Variable Name | Variable Type | Default Value |
   | --- | --- | --- |
   | `rangeResult` | **String** | **N/A** |
   | `sheets` | **ListString** | **N/A** |
5. Add an Excel **Copy Sheet** activity inside the **Do** container.
   * In the **Properties** panel, add the expression `"copy_destination.xlsx"` in the **DestinationFilePath** field.
   * Add the name `"New Sheet"` in the **DestinationSheetName** field and the value `"SalesOrders"` in the **SheetName** field.
6. Place another **Excel Application Scope** below the first one.
   * Add the path `"copy_destination.xlsx"` in the **WorkbookPath** field.
   * In the **Properties** panel, select the check boxes for the **AutoSave**, **CreateNewFile** and **Visible** options. The robot is now allowed to create a new Excel workbook, to automatically save all the changes made to it and to open the Excel file in the foreground while performing actions on it.
7. Select the **Do** container and create the following variables:

   | Variable Name | Variable Type | Default Value |
   | --- | --- | --- |
   | `rangeResult` | **String** | N\A |
   | `sheets` | **ListString** | N\A |
8. Add an Excel **Delete Range** activity inside the **Do** container.
   * In the **Properties** panel, add the expression `"A10:G20"` in the **Range** field and the name `"New Sheet"` in the **SheetName** field.
   * Select the check box for the **ShiftCells** option. By checking this option, the cells are shifted according to the Shift Option.
   * Select the option `ShiftUp` from the **ShiftOption** drop-down list.
9. Run the process. The automation process copies the data from one workbook to a new one and deletes the specified range of rows.

[Download example](https://docexamples.uipath.com/examples/Activities/Manipulate%20Range%20Selections%20-%20Example.zip)
