How to save email attachments and read data

How to save attachments from Gmail and read data from it?

Hi
Welcome to uipath community
We can use GET IMAP MAIL ACTIVITY or GET POP3 MAIL ACTIVITY to get the mail list from gmail with a variable named list_mailmessage
—then use a FOR EACH activity where pass the variable obtained above list_mailmessage and change the type argument as System.Net.Mail.Mailmessage in the property panel of for each loop
—inside the loop use SAVE ATTACHMENT activity where mention the mail input as item and mention the folder path where we want to save that attachment

—the we can use either EXCEL APPLICATION SCOPE and mention the same file path if it’s excel file or READ PDF activity if it’s a pdf file, while still being inside the for each loop itself

Hope this would help you
Cheers @Riya_Lanjewar

1 Like

Hi,
Thank you so much for your reply. Really helpful. By following your steps I can save all attachments!
With Read PDF activity, we need to give a path of a particular file. Can’t we save data from all files in one Go?

@Palaniyappan :slight_smile:

Hi @Riya_Lanjewar

You can use a string variable and give Directory.getfiles(“your current path”,".pdf")

Thanks
Ashwin.S

Fine once after saving the pdf files in the folder with SAVE ATTACHMENT activity m, followed by this FOR EACH activity use a ASSIGN activity like this
arr_pdffiles = Directory.GetFiles(“yourfolderpath”,”*.pdf”)

Where arr_pdffiles is a variable of type array of string which will hold the file path of only pdf from that folder
—then use a FOR EACH activity and mention the variable name as arr_pdffiles and change the type argument as string in the property panel of for each
—inside the loop use READ PDF or READ PDF OCR (if the pdf has text In a image) and pass the file path as item.ToString which will take the pdf files and process them in one go but in iteration within for each loop

Hope this would help you
Cheers @Riya_Lanjewar

1 Like

@Palaniyappan
I followed your steps, but not able to read data.

Fine
May I know what was the issue you were facing
Cheers @Riya_Lanjewar

It shows task started and ended.
@Palaniyappan