Subscribe

UiPath StudioX

The UiPath StudioX Guide

Tutorial: Formatting Cells

In this tutorial, we will create a simple automation that applies one format to the cells in the header row of a spreadsheet and another format to the cells in the first column of the same spreadsheet. We will apply each format to a cell in the project's Excel Workspace, and then use two Copy Paste Range activities to copy the format of each cell to the intended row and column in our spreadsheet.

Step 1: Set up the project and get the necessary files

  1. Create a new project using the default settings.
  2. Download and extract the archive with the automation project in this tutorial using the button at the bottom of this page and copy the file DoubleUI.xlsx to your project folder.

Step 2: Apply the desired formats to two cells in the Excel Workspace.

  1. Click Open Excel Workspace in the StudioX ribbon menu. The file Excel_Workspace.xlsx is opened.
  2. Apply the following format for the first column to cell A1 in the Scratchpad sheet of the Excel Workspace:
    • Fill Color: Light Blue
    • Number format with two decimal spaces
  3. Apply the following format for the header row to cell B1 in the Scratchpad sheet of the Excel Workspace:
    • Fill Color: Light Gray
    • Font Style: Bold
  4. Save and close the Excel Workspace.

Step 3: Add DoubleUI.xlsx to the project and copy the formats to the column and row.

  1. Click plus_icon on the Designer panel.
  2. In the Common Scenarios section of the search box at the top of the screen, double-click Use Excel File, and then browse to and select the file DoubleUI.xlsx. An Excel File Card activity is added to the Designer panel.
  3. In the activity, in the field And reference it later as, enter DoubleUI.
    You have indicated that you will work on the file DoubleUI.xlsx that is known in your automation as DoubleUI.
  4. In the Excel File Card, click plus_icon, then find the Copy Paste Range activity in the search box at the top of the screen and double-click it. The activity is added inside the Excel File Card.
  5. In the Copy Paste Range activity:
    • Click plus button on the right side of the Source range field, and then select Workspace Excel > Indicate in Excel.
    • In the Excel file, select cell A1 in the Scratchpad sheet, and then click Confirm in the UiPath tab in the Excel ribbon menu.
      You have indicated that you want to copy the A1 cell from the Scratchpad sheet of the Excel Workspace.
    • Click plus button on the right side of the Destination range field, and then select DoubleUI > Indicate in Excel.
    • In the Excel file, select the entire column A, and then click Confirm in the UiPath tab in the Excel ribbon menu.
      You have indicated that you want to paste the data to the first column in the DoubleUI file.
    • From the What to copy drop-down menu, select Formats to indicate that only the cell formatting should be copied.
  6. Add a second Copy Paste Range activity just below the existing one.
  7. In the second Copy Paste Range activity:
    • Click plus button on the right side of the Source range field, and then select Workspace Excel > Indicate in Excel.
    • In the Excel file, select cell B1 in the Scratchpad sheet, and then click Confirm in the UiPath tab in the Excel ribbon menu.
      You have indicated that you want to copy the B1 cell from the Scratchpad sheet of the Excel Workspace.
    • Click plus button on the right side of the Destination range field, and then select DoubleUI > Indicate in Excel.
    • In the Excel file, select the header row (range A1:D1), and then click Confirm in the UiPath tab in the Excel ribbon menu.
      You have indicated that you want to paste the data to the range A1:D1 in the DoubleUI file.
    • From the What to copy drop-down menu, select Formats to indicate that only the cell formatting should be copied.
545
  1. Click Save in the ribbon menu to save the automation, then click Run to execute the automation.

The formatting is copied from the two cells in the Scratchpad sheet of the Excel Workspace file to the header row and first column of the DoubleUI file.

Download example

Updated 2 years ago


Tutorial: Formatting Cells


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.