Rizwan
Rizwan Asif I am a technopreneur exploring the field of artificial intelligence to build the next big thing in tech. My vision for the world is to reduce human capital for low level system tasks and put humans in the higher decision making positions. We are not meant to sort stamp papers, we will give up that task to create something beautiful. 8 min read

Robotic Process Automation (RPA): Automating Your Office Chores

Robotic Process Automation (RPA): Automating Your Office Chores

I came across the term Robotic Process Automation (RPA) [1], when suddenly in 2019 many of my job alerts were all about "RPA Engineer Required!". Being in the robotics space, it came as a curiosity. However, I quickly found that it has nothing to do with robotics.

RPA is a quicker and more understandable methodology to create programs that do boring tasks for us. A more refined definition will be,

Robotic Process Automation (RPA) is the use of computer programs to perform repetitive and labor-intensive tasks.

Repetitive tasks could be like sending emails [2], verifying receipts [3], scraping data from a website [4]. These can take an average person several minutes to several hours. If such tasks can be handed over to robots (each automated program is basically a robot), then employees can make more time to work on creative ideas. The things that humans are good at.

This article describes an RPA use case, with my personal experience. I'll first explain my motivation with RPA, then we'll see how we can solve an automated emailing issue that involves reading data from Google Sheets.

Working with RPA

I decided to give RPA a shot while I was working for Addressya. We had a shared Google Sheet where everyone put in the time they will be working the next week. Because of flexible hours, it was important everyone knows when are the colleagues working. However, most employees forget to report their times. Therefore, one of our colleagues had to send a reminder to all the defaulters. This seemed like a good opportunity to try something new. I decided to read the Google Sheet, find the defaulted person and send them an email.

Robot Partner

I choose UiPath [5], an RPA platform development platform, because of their community edition that can be used for free. Moreover, the program can be reused on different machines. UiPath has these visual snippets or components called Activities. To use an activity, all you need to do is drag and drop in the main workplace and reorder activities according to needs.

Reading Data from Google Spread Sheets

I saw a few tutorials on the UiPath Academy and decided to get right into it. The first step was to read data through Google Sheets. The following steps are for recreating the application, you can skip if you like.

  • Before we begin, install the Google Spread Sheet package using the package manager.
  • UiPath Package Manager

  • We start with adding the Google Sheet Application Scope activity. It requires a Google Cloud Service account for functioning. A key path is a file obtained as a result of creating this account. While the Sheet ID can be obtained from the URL of the Google Sheet.
  • In this application scope, we add the Read Range activity. This activity requires a spreadsheet style range parameter and the worksheet name i.e. "Sheet1" if you have a default sheet. The result is stored in a variable of type DataTable.
  • If all the information is correct then the data should be read correctly. You can try writing the DataTable locally using the Write Range activity from Excel, this should create an Excel file on your PC.

    Processing Data

    In order to make the data fetched from Google Sheets useful, I did some processing using For Each, Assign and If activities. The purpose was to see if any employee forgot to fill their expected attendance and to extract their email address. It was pretty easy to understand and use, except for one operation, i.e. looping over a DataTable. Therefore, I will just discuss that.

    I created a nested loop situation, with the outer loop reading a row in the DataTable. In order to read the row by column by index, I used the second loop over a list of indexes from 0 to the length of the row.

    System.Linq.Enumerable.Range(0, row.ItemArray.Length).ToArray()

    Then, I used the assign activity to read each column of that row. An If activity checked if the cell was empty. If yes, then I stored the name of that person.

    UiPath For Each Loop

    Sending Emails

    Now that I had the name of the defaulter, it's time to send them an Email. The Send SMTP Mail Message activity is pretty simple to use. All you need is your port and server address of your the email account you want to send it from. In my case, this was Gmail i.e. 587 and smtp.gmail.com respectively.

    One issue was that the email body did not incorporate spaces. I had to use the NewLine property in C#. Which wasn't easy to find since I am not that familiar with C#.

    Environment.NewLine
    UiPath Email Body

    Putting to Test

    I really enjoyed how it worked. Once a robot was deployed it took a click to fire it up. UiPath gives a second application called UiPath Robots to invoke a specific robot.

    UiPath Robots

    I added a little pop-up at the start to add the Google Sheet name so that my colleague sending the reminders shouldn't be concerned about the code. If we add the sheet name then emails will automatically be sent to all defaulting employees.

    UiPath Pop-up

    Discussion

    It really piqued my interest and I wanted to know how people are using it these days. The response I have so far from SMEs is the concern about privacy and usage of sensitive data. Moreover, some startups have found it not at all convenient. For example in Sweden, we use BankId as a way to confirm payment transfers. Which requires a passcode to log in. The problem is that if this passcode ends up in the wrong hands then it could be catastrophic for the company, therefore they refrain on giving complete control to a machine. On the other hand, RPA can involve human intervention in such sensitive matters (like I did with the initial pop-up), but this increases the inconvenience. Hence, RPA developers should start working on solutions to handle sensitive data.

    Conclusion

    To close this, I would say RPA is a useful tool of the future. We are seeing the banking sector adopting it pretty quickly [6]. It's not far that other sectors will see the potential soon enough. The whole process is fun, I guess with a little practice anyone with basic programming skills can get used to it. UiPath is clean and convenient.

    For those who think that RPA is coming for their jobs, well yes and no. RPA is a tool to enhance your productivity in the workspace and not replace you. You can forget about sending boring emails and instead focus on building value for the company. In that case, you are worth more than a thousand RPA robots.

    Reference Shelf

    [1] van der Aalst, W. M., Bichler, M., & Heinzl, A. (2018). Robotic process automation.

    [2] Ionescu, V. (n.d.). Send Email Automation. Retrieved May 21, 2019, from https://www.uipath.com/kb-articles/send-email-automation

    [3] Rossum and UiPath: Invoice extraction in 15 minutes (source code provided) - Cognitive Data Capture, Machine Learning, AI. (2019, May 15). Retrieved May 21, 2019, from https://rossum.ai/blog/rossum-and-uipath-invoice-extraction-in-15-minutes-source-code-provided/

    [4] Badita, M. (n.d.). Web Data Extraction. Retrieved May 21, 2019, from https://www.uipath.com/kb-articles/web-data-extraction

    [5] Tripathi, A. M. (2018). Learning Robotic Process Automation: Create Software robots and automate business processes with the leading RPA tool–UiPath. Packt Publishing Ltd.

    [6] “Robotics in Banking with 4 RPA Use Case Examples | The Lab.” The Lab Consulting, 9 Apr. 2019, thelabconsulting.com/robotics-in-banking-with-4-rpa-use-case-examples/.

    Rizwan
    Rizwan Asif I am a technopreneur exploring the field of artificial intelligence to build the next big thing in tech. My vision for the world is to reduce human capital for low level system tasks and put humans in the higher decision making positions. We are not meant to sort stamp papers, we will give up that task to create something beautiful. 8 min read

    Resolving Ethical Dilemma in Artificial Intelligence

    How Artificial Intelligence can learn the way humans do.

    Teaching Machines About Human Ethics

    Let's teach artificial intelligence they way we learn.. by storytelling. Advancement in artificial intelligence is picking up pace at a substantial level. Entering humans in to an era where decision making will be at least machine consulted, if not machine governed. Since, these intelligent machines or agents do not experience the same emotions and experiences as humans do.

    Deploy Directly From GitLab to Google App Engine - Rizwan Asif - Medium

    A simple tutorial to make your application ready for continuous integration. Just push to your GitLab repository and it is deployed. Google App Engine (GAE) is a robust platform for deploying web applications quickly and safely. I have been using GAE for quite some while now and have certainly faced lesser road blocks than my friends using competitive services.