Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Robotic Process Automation Projects

You're reading from   Robotic Process Automation Projects Build real-world RPA solutions using UiPath and Automation Anywhere

Arrow left icon
Product type Paperback
Published in May 2020
Publisher Packt
ISBN-13 9781839217357
Length 388 pages
Edition 1st Edition
Arrow right icon
Authors (3):
Arrow left icon
Ivan Loncar Ivan Loncar
Author Profile Icon Ivan Loncar
Ivan Loncar
Arun Kumar Asokan Arun Kumar Asokan
Author Profile Icon Arun Kumar Asokan
Arun Kumar Asokan
Nandan Mullakara Nandan Mullakara
Author Profile Icon Nandan Mullakara
Nandan Mullakara
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Getting Started with Robotic Process Automation 2. Help Desk Ticket Generation FREE CHAPTER 3. CRM Automation 4. Moderating Social Media Using AI 5. Purchase Order Processing with UiPath ReFramework 6. Completing an RPA Challenge 7. Sales Order Processing 8. ERP User Administration 9. Employee Emergency Notifications 10. Using AI and RPA for Invoice Processing 11. Other Books You May Enjoy Appendix A and B for UiPath 1. Appendix: Looking Forward and Next Steps

Reading from Excel

In this next workflow, we will pick up the Request Excel file from the folder we created, read the ticket data, and incorporate them in variables for the next workflow to process. This will help you get your feet wet with Excel-based automation:

  1. Let's start by creating a new Sequence in the project. This will create a new workflow for us to work on:

  1. Let's name it ReadExcelRequest and click Create. The studio will create a default sequence for you:

  1. Within the workflow, let's first add the arguments using the Arguments tab at the bottom of Studio (refer to the following information box). Arguments will enable us to input and output data from this workflow to the main workflow. Proceed and create four arguments, as shown in the following screenshot: 

Note Direction and Argument type.

The difference between a variable and an argument is that variables pass data to other activities, while arguments pass data to other workflows. The Arguments tab is next to the Variables tab at the bottom of the Studio screen.
  1. We will always use a Try-Catch block to handle any exceptions gracefully. So, let's add the Try Catch activity to this sequence. Then, within the Try block, add the Read Range activity under Workbook to read the specified Excel file. The Read Range activity reads the value of a specified Excel range and stores it in a DataTable variable.
  1. For the WorkbookPath, specify the RequestFilePath argument that we added in step 2. This argument should be populated with the path to Requests.xlsx when we invoke this workflow from Main. Your sequence and properties should look like this:

In the properties for the Read Range activities, perform the following steps:

    • Remove the range to cover the entire sheet. To do that, add “” to the Range property on the right pane.
    • While there, uncheck the AddHeaders property as we don’t have header in our input file.
    • Add an Output variable to store the data table. Use Ctrl + K to add the dtRequest variable within the DataTable property.
  1. Next, we will use three Assign activities in the workflow to read from Excel and store the data for ContactName, Email, and Subject in respective arguments.
  2. Use the arguments we just created on the left-hand side of the activity. You can start typing the argument names and the argument names should pop up for you to select:

  1. We will use the dtRequest.Rows(row)(column) data table to read Excel values and map them to the arguments. For example, dtRequest.Rows(0)(1) means the first row and second column value in Excel. Since the output variable only accepts the values of the String type, we have to add .tostring at the end of this formula; for example, dtRequest.Rows(0)(1).ToString:

  1. After the Assign activities, add a Log Message activity to update the Excel read options in the system logs. This will help us to debug the workflow if needed:

That completes our Try block sequence. We will now add exception handling to the Catches block.

You have been reading a chapter from
Robotic Process Automation Projects
Published in: May 2020
Publisher: Packt
ISBN-13: 9781839217357
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image