activities
latest
false
Productivity Activities
Last updated Oct 23, 2024

Manage Range Selection

The example below explains how to select a range of rows and columns from an Excel file and how to inform the user about the selected range. It presents activities such as Select Range and Get Selected 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.
  3. Place an Excel Application Scope activity in the body of the sequence.

    • In the Properties panel, add the path "example.xlsx" 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.
    • Create a variable named rangeResult and of type String.
  4. Place a Select Range activity inside the Do sequence of the Excel Application Scope activity.

    • In the SheetName field enter the name "SalesOrders" and in the Range field add the value "A2:G10".
  5. Add a Message Box activity below the Select Range activity.

    • In the Properties panel, add the message "Check the selection in the open Excel file!" in the Text field.
    • Select the check box for the option TopMost for always having the message displayed in the foreground.
  6. Drag a Get Selected Range activity under the Message Box activity.

    • In the Properties panel, add the variable rangeResult in the Range field.
  7. Place a Message Box activity below the Get Selected Range activity.

    • Add the variable rangeResult in the Text field.
    • Select the check box for the option TopMost for always having the message displayed in the foreground.
  8. Run the example. The automation process opens the Excel file, selects a range that can be viewed in the example.xlsx file and also displays the selected range in a message box.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.