2

I am using UiPath to create a robot to get files from email. Some files are password protected and some files are not protected.

The password-protected files are sent in with a password in email body.

Example email
From: ABC <abc@outlook.com>
Sent: Monday, 5 October 2020 10:54 AM
To: BCD <bcd@outlook.com>
Subject: Files

Attached files

The password is: ......

There can be 10 emails and 2 have password-protected files do I let the robot know which files are password protected and to open the password-protected Excel file and move the data to a mega Excel sheet containing all the files from the 10 emails.

I am unsure of the activities to put in the workflow to perform these functions. I am also unsure if the below method I did is the right way to approach this.

So I do a Get outlook message and save attachments to attachment folder.

And I created a get files from folder process because I wanted to do a for loop to check if each file is protected by password and I do not know how to continue.

This is my main workflow

enter image description here

Jun Liang
  • 71
  • 1
  • 7

3 Answers3

0

This is just one option you have. As I had good experiences in the past with the BalaReva.Excel.Activities, maybe it's worth to be tested by you.

So as the image shows, this Connect comes with plenty of Libraries. You need to download the whole package and take the functionality ProtectUnProtectSheet. That activity should work on your case.

BalaReva.Excel.Activities

For a full example check out this.

kwoxer
  • 3,734
  • 4
  • 40
  • 70
  • Hi kwoxer, i am not trying to protect the UnProtectedSheet. I am trying to retrieve the password from the email body to open the excel file that is attached to the email to add the data inside the excel file to a mega excel file with all email files. – Jun Liang Oct 06 '20 at 03:17
  • https://analysistabs.com/excel-vba/protect-unprotect-worksheets/ – kwoxer Oct 06 '20 at 04:56
  • Hi i have tested the program but it does not fulfill my requirements as my rpa is required to open excel files of different passwords from the email body. Is there an alternate workaround to this program to fulfill the requirements – Jun Liang Oct 09 '20 at 04:01
0

I'm not sure at what step of your flow you are having problems with, but here are a few pointers on some of the things you need to do after you manage to iterate through each email (which you seem to be doing already):

  • to extract passwords from email bodies. You could do two things here: either apply a Regex directly on the string with the content (if you are confortable writing a few 1-2 line of vb.net code) or you go the long route of using IntelligentOCR package, Digitize the text (you will have to write it to a file first), extract the data using "Extraction Scope" and "Regex Extractor", and take it from the results json with extracted data
  • open Excel and use the password: there is a package called UIPath.Activities.Excel that can do this.
Tudor Carean
  • 972
  • 2
  • 12
  • 22
  • Hi if i did it like attachment 6 am i doing it right i could not find the extraction scope and regex extractor too. I got the email from the mail and i wrote a if regex (password) in mail body move the attachment to password folder. Or am i supposed to save the file location and password to a excel file – Jun Liang Oct 12 '20 at 14:09
0

Did you try to get System.Net.Mail.MailMessage.Body (https://learn.microsoft.com/en-us/dotnet/api/system.net.mail.mailmessage.body?view=netcore-3.1) and parse the string to search the password? So in your for each loop, you can use "mail.Body" and retrieve all email text.

q.gio
  • 46
  • 3