New RPA developer here with very limited experience.
I have a list of records in Excel, each record has an email address. I want to select 1 email address from Excel randomly and then email this user.
I have a workflow that reads all records in an Excel file and then emails all users that have an email address.
How could I adapt this automation?
Please note I don’t have a data table as I can’t get it to work correctly.
Any tips here are greatly appreciated. If you know of a recent video where this is shown can you please reply, I have some other videos from 3 and 4 years ago, but there are differences in studio that I haven’t been able to resolve.
Hie @fee3f91749a34c0c00102720d use read range workbook to read the dt and save it into a variable let’s say dt1
use for each row activity to iterate data one by one
inside this use if condition - and inside if use currentrow("column Name).tostring.equals("xyz.gmail.com)if it true or match
then inside then branch use send mail activity
cheers Happy Automation
To achieve your goal of selecting a random email address from an Excel file and sending an email to that user using UiPath Studio, you can follow these steps:
Read the Excel file to get the list of email addresses.
Select a random email address from the list.
Send an email to the selected email address.
Here’s a step-by-step guide to help you build this automation:
Step 1: Read the Excel File
Add the Excel Application Scope activity to open your Excel file.
Set the FilePath property to the path of your Excel file.
Use the Read Range activity to read the data from the Excel file into a DataTable.
In the Read Range activity, set the SheetName and Range properties as needed.
Store the output in a variable, e.g., dtEmails.
Step 2: Select a Random Email Address
Get the Row Count of the DataTable to determine the number of email addresses.
Use the Assign activity: rowCount = dtEmails.Rows.Count
Generate a Random Index to select a random email address.
Use the Assign activity to create a random number: randomIndex = New Random().Next(0, rowCount)
Get the Email Address at the random index.
Use the Assign activity to extract the email address: selectedEmail = dtEmails.Rows(randomIndex)("EmailAddress").ToString
Step 3: Send an Email
Add the Send Outlook Mail Message activity (or the appropriate mail activity for your email service).