Capture First Name, Last Name, Email Address from Email Messages

Hello, I am new to UiPath and am trying to figure out how to capture data from email messages. What I want to do is extract the name of the sender and the email address of the sender and write it to an excel file.

I know how to set up the ‘get outlook mail messages’ but haven’t been able to figure out what i should do next…I have tried a few things with no luck.

Can anyone help out with this? Looking forward to your input

Thank you!


You can get the senders detail by using mymails(0).sender.ToString
where my mymails is the list variable which will be the output of your get outlook mail message activity.

1 Like

Hello, thanks for your reply. do you mind explaining the steps a little more clearly,i.e step by step?

I would appreciate it. thanks again!

Hi @VanRobby,

Check the attached Workflow you will get basic idea to work with outlook mail items,

MailProcess.xaml (12.1 KB)

Let us know still you need more information.


Thank you! This makes sense. However, I have a few questions:

  1. For the ‘Write Line’ activity, where is the line being written to? There’s no output variable to write the line to…
  2. Once i’ve written the line, how do i get the written line into an excel workbook?

thanks again for your help.


That writeline activity will write into the output tab of your UiPath studio. thats for reference I have used. You need to use Assign Activity with desired variables to get it out of the execution to log somewhere.

Hey @VanRobby the Write Line activity will print the result in the output pane lower down on your screen.

Write Line is only used to print the output on the screen.If you want to write it in an excel sheet, you can store values in a variable first and then use “Write Range” or “Write Cell” activities to write the data contained in the variable in an excel sheet.

Ok thank you,Is that ‘textwriter’ field in properties of ‘Write Line’ used to write the string to a variable? Otherwise, how do i get the output from the output panel?

As @sarathi125 has already told you need to use an assign activity to store the data in a variable instead of printing it through writeline…
like this:

Thanks for your response. So this is the method i tried first (before i opened this thread). I used the ‘assign’ activity to assign ‘item.from.displayname.tostring’ to a variable ‘display name.’ I can make this work with a message box but when i go to write the content in the variable to a workbook, i get the error in my screenshot below…

When i try the same method but switch the ‘write range’ with ‘write cell,’ it works but it only copies one cell to the worksheet, not a record for each email…

Any help would be appreciated

You need to first populate the data into a data table and then pass that in write range activity, as it only accepts data table!
So first you need to create a data table using build data table and then using add data row activity you can fill the data table with the values stores in these variables(EmailAddress and DisplayName)

You can also use Write Cell , in that you can directly pass this string DisplayName

Hey Mark,

I am facing the same challenge if you find an answer please get in touch with me on we will figure out a way to workout commercially

+91 88 66 55 1979

Hey Sourav,

I am looking for same solution can you help me out with it we can work out commercially if you want.Please drop me an email on

+91 88 66 55 1979

Hi everyone, i’ve made some progress…I am using 2 ‘assign’ activities to assign from each mailmessase the ‘item.from.displayname.tostring’ & the ‘item.from.address.tostring’ to two string variables.

next, i setup 2 ‘Write Cell’ activities that write the variable data to the output excel file.

However, it only writes one row,

any idea on how to make this ‘loop’ or write all of the rows to the excel file,there should be 30 rows as i selected ‘top 30’ in the mail settings.

I have attached the XAML fileEmail Practice.xaml (9.9 KB)

@Niket_Ghai @Rishabh_Lakhera @sarathi125 @Sourav_Anand

Hi @VanRobby,

Sorry for the delayed reply.

Your Write cell activities also should come inside of the For Loop statement scope.

Hope this will resolve your issue and make you to understand the actual process.


HI @sarathi125 I added both ‘write cell’s’ into the ‘For Each’ pane. I still just get 1 line in the output excel worksheet.

In the Output window in the bottom right hand corner i can see that its writing all of the right lines (not just the one line),but they arent being written to the excel file…

Any other suggestions?

In the writeline you are using cell name as “B1” and “A1” so this cells will be over written all the times.

If you want to write to next cells then increase the cell numbers like “B” + someLoopCount.ToString

The loop count should start with 1 since cell names are starting as A1, B1 Like that…

Try like this and post here if you need further help.

Thanks @sarathi125 do you think you could show me exactly what you mean in the XAML file ive attached. I don’t fully understand the someloopcount.tostring part. not too sure how this is supposed to be written…


markEmail Practice.xaml (9.9 KB)


Try with this Xaml, I have modified it, but not tested. Check and let me know if you are facing issues

Email Practice (1).xaml (10.7 KB)