Design a Bot Using Excel Automation Activities

This tutorial shows you how to design a simple bot to automatically perform a specific task in Microsoft Excel.

The bot will write data into specified cells and then create a chart based on the data. The Excel file will also be automatically saved in your computer.

Background

You use only the activities available in Excel Automation to create the bot.

Prerequisites

  • Access to ASG Studio Manager.
  • Check the availability of the Microsoft Excel application on your machine.

Design the Bot

In this section, you design the RPA Model for performing the Excel automation task.

  1. Launch ASG-Studio.
  2. Create an RPA Model. See Create and Design RPA Model.
    Alternatively, you can open an existing RPA Model. If you are using an existing RPA Model click Clear in the Element Toolbar to remove any activities that have been previously added to the visual designer.
  3. In the visual designer, drag Start Event from the element tool and drop it on the visual designer. Keep the default activity name.
  4. In the Activities Panel, expand Excel Automation, then drag the following activities and drop them onto the visual designer.

    To connect the activity shapes, select the first activity shape, click and hold the Sequence Flow or Association arrow icon, drag the arrow to the other shape, and then click the second activity shape.

    Action Name

    Name

    Other Properties

    Connect From

    Connect To

    Create Workbook

    Default activity name

    • Instance Name: excel1
    • File Path: C:\Users\%userprofile%\Documents\Book1

    Start

    Create Workbook

    Create Sheet

    Create Sheet Expenses

    • Sheet Name: Expenses

    Create Workbook

    Create Sheet Expenses

    Set Cell

    Set Expenses

    • Instance Name: excel1
    • Click Add
    • Location: C4
    • Text: Product 1
    • Location: C5

    • Text: Product 2
    • Location: D3.

    • Text: HYD
    • Location: D4

    • Text: 178
    • Location: D5

    • Text: 198
    • Location: E3.

    • Text: BGLR
    • Location: E4

    • Text: 287
    • Location: E5

    • Text: 199

    Create Sheet Expenses

    Set Expenses

    Create Sheet

    Create Sheet A1

    Sheet Name: A1

    Set Expenses

    Create Sheet A1

    Set Cell

    Set B2

    • Instance Name: excel1
    • Location: B2
    • Text: Testing Excel Automation

    Create Sheet A1

    Set B2

    Active Excel Sheet

    Active Excel Sheet Expenses

    • Instance Name: excel1
    • Enter Sheetname to Active: Expenses

    Set B2

    Active Excel Sheet Expenses

    Set Cell

    Set C6

    • Instance Name: excel1
    • Click Add
    • Text: Product 3
    • Location: C6
    • Location: D6

    • Text: 260
    • Location: E6

    • Text: 300

    Active Excel Sheet Expenses

    Set C6

    Create Chart

    Default activity name

    • Instance Name: excel1
    • Range From: C3
    • Range To: E6
    • Chart Type: (Select) Bar Chart

    Set C6

    Create Chart

    Save Workbook

    Default activity name

    • Instance Name: excel1
    • Choose Save/Save as: (Select) Save

    Create Chart

    Save Workbook

    Active Excel Sheet

    Active Excel Sheet A1

    • Instance Name: excel1
    • Enter Sheetname to Active: A1

    Save Workbook

    Active Excel Sheet A1

    Delete Row

    Default activity name

    • Instance Name: excel1
    • Row Number: B2 Shift Up: (Select) Yes

    Active Excel Sheet A1

    Delete Row

    Set Cell

    Set A1

    • Instance Name: excel1
    • Text: Excel Automation Bot
    • Location: A1

    Delete Row

    Set A1

    Close Workbook

    Default activity name

    • Instance Name: excel1
    • Workbook to be save: (Select) Yes

    Set A1

    Close Workbook

    Open Workbook

    Default activity name

    • Instance Name: A1
    • Workbook FilePath: C:\Users\%userprofile%\Documents\Book1

    Close Workbook

    Open Workbook

  5. Drag End Event from the Element Toolbar and drop it on the visual designer. Keep the default activity name. Connect Open Workbook to End Event.
  6. In the Element Toolbar of the visual designer, click Run to execute the RPA Model.
    • A message is displayed in the visual designer after successful completion of the RPA Model execution.
    • When the execution is completed, open the Book1.xlsx file check the written data and the Bar Chart in Expenses spreadsheet.