Robotic Process Automation
Robotic Process Automation
Assignment - I
1: Using UiPath Studio, you must read from or write to excel file. The file might be locked, missing, or
corrupted, causing errors. How would you handle errors when trying to read data from an Excel file?
Steps:
To handle errors when reading data from an Excel file using UiPath Studio, we can use a Try-Catch block.
1. Create a Sequence:
o Start by creating a new Sequence activity in UiPath Studio.
2. Add Excel Application Scope:
o Drag and drop the Excel Application Scope activity into the sequence.
o Specify the file path of the Excel file in the Workbook Path property.
Explanation:
To handle errors while reading an Excel file in UiPath, we can use a Try-Catch block to ensure robust error
handling. By enclosing the activities related to reading Excel files (such as Excel Application Scope and Read
Range) within the Try block, any exceptions like locked files, missing files, or corrupted files are gracefully
caught. The Catch block logs or displays the error message using activities like Log Message or Write Line,
ensuring the workflow does not crash. For example, if the file is locked, the error message might indicate that
the file is in use by another process; if the file is missing, the message will indicate the file could not be found.
This approach ensures smooth workflow execution by providing informative error messages while maintaining
the ability to handle exceptions dynamically, such as by implementing retry mechanisms for transient issues.
Output:
2: Use UiPath Studio to read payroll details for employees in an Excel file. You need to calculate the salary
for each employee based on attendance. Use Read Range to extract employee payroll data. Apply
calculations(eg., salary) Write the updated data into a new Excel file
Steps
1. Create a Sequence:
o Start by creating a new Sequence activity in UiPath Studio.
2. Read Payroll Data:
o Add an Excel Application Scope activity and set the file path for the payroll Excel file.
o Inside the scope, use a Read Range activity to read the payroll data (e.g., from Sheet1) into a
DataTable variable (e.g., test.xlsx).
3: Use OCR to digitize handwritten essays or assignments and convert them into editable text.
Steps
1. Prepare the Input:
o Take a clear picture of the handwritten assignment or essay and save it as an image file (e.g.,
.jpg or .png).
2. Create a Sequence:
o Start by creating a new Sequence activity in UiPath Studio.
3. Load the Image:
o Drag the Load Image activity into the sequence and select the image file from your computer.
4. Use OCR
o Drag the Google Cloud Vision OCR activity into the sequence.
o Configure the ApiKey (from Google Cloud Console) and specify the Output Path Variable..
Output:
5: Given an array of integers. Illustrate step by step example using uipath that count total number of odd
elements and even elements in the array and display the count in output panel.
Steps
1. Create a Sequence:
o Start by creating a new Sequence activity in UiPath Studio.
2. Declare Variables:
o Create a variable named numbers of type Array of Int32 to hold the array of integers and add
an array of numbers as its default value.
o Create two variables: oddCount and evenCount of type Int32 and initialize both to 0.
5. Add an If Condition:
o Inside the For Each loop, drag an If activity to check if the number is odd or even:
Condition: num Mod 2 = 0
6. Increment Even Count:
o In the Then section of the If condition, use an Assign activity to increment the evenCount:
evenCount = evenCount + 1
7. Increment Odd Count:
o In the Else section, use an Assign activity to increment the oddCount:
oddCount = oddCount + 1
6: Trigger: Ctrl + S key press. Action: Use Send Hotkey activity to press Enter on the Save dialog or provide
a path to save the file.
Steps
1. Create a Sequence:
o Start by creating a new Sequence activity in UiPath Studio.
2. Send Ctrl + S Hotkey:
o Drag and drop the Send Hotkey activity into the sequence.
o Set the Key property to "S" and in the Modifiers property, set it to "Ctrl" to simulate Ctrl + S.
Example:
o Key: S
o Modifiers: Ctrl
9: Use the basic recording and do the automation of opening notepad. Type Into activity to type the text
("Hello, UiPath!") in the Notepad window. Click activity to interact with the File menu, select Save As,
and save the file to the disk.
Steps
1. Start a New Recording:
o Open UiPath Studio and create a new project.
o Use Basic Recording to capture the steps for automating Notepad.
2. Open Notepad:
o Click on Record and select the Open Application option to launch Notepad.
o In the Notepad window, you can click on the "Start" menu and type Notepad to open it. UiPath
will capture this action.
7. Click Save:
o Add another Click activity to click on the Save button in the Save As dialog box.
8. Close Notepad:
o After saving, use a Close Application activity to close Notepad.
Output:
10: Use web recording perform the following Open Google: Type https://www.google.com in the address
bar and press Enter. Type UiPath in the Google search bar and press EnterClick on the first result: After
the search results load, click on the first search result linkAfter performing the actions, click on the Stop
Recording button.
Steps
1. Start a New Web Recording:
o Open UiPath Studio and create a new project.
o In the Design tab, select Recording and choose Web Recording.
2. Open Google:
o When the Web Recording toolbar opens, click on Start Recording.
o In the Address Bar of the browser, type https://www.google.com and press Enter.
o UiPath will automatically capture this action and generate the appropriate activity for opening
Google.
3. Type "UiPath" in the Google Search Bar:
o Once Google loads, click on the Search Box (Google's search bar).
o Type UiPath in the search bar and press Enter.
o The Type Into activity will be used to type the search term, and the Send Hotkey activity
will simulate pressing Enter.
4. Click on the First Search Result:
o After the search results load, hover over the first search result link.
o Click on the first result link to open it. UiPath will capture this as a Click activity.
5. Stop Recording:
o Once the action is complete, click on the Stop Recording button in the Web Recording toolbar.
Output: