Excel To Outlook mail filtering

Hi
I need to use a excel sheet which has a header “Country Name” it has countries like ‘Argentina’, ‘Chile’, ‘Colombia.’
When I get mail with this country names in subject. I need to filter mails and save the attachments.
Another issue here is each country has many mails like “FW: Argentina Facturación AUG2023”,“Argentina Facturación SEP2023”
Hope the question is clear.
Thanks in advance!:slight_smile:

1 Like

Hi @abivanth.r ,

If you want to filter the mail on subject line you can do as below

"@SQL=(\"urn:schemas:httpmail:subject\" LIKE '%Argentina%')"
"@SQL=(""urn:schemas:httpmail:subject"" LIKE '%"+yourvairable+"')"

Regards,
Vinit Mhatre

1 Like

Hi I am attaching my .xaml please check once

1 Like

Hi @abivanth.r ,

Yes Sure

Regards,
Vinit Mhatre

1 Like

Main.xaml (19.3 KB)

1 Like

Hi @abivanth.r ,

Could you share me your excel data?

Regards,
Vinit Mhatre

1 Like

Counrty list 3.xlsx (9.2 KB)

1 Like

So as per my understanding process is as below tell me if i am not wrong…

  1. Read the Excel data with countries.
  2. Get the mail data whose subject line contains countries names one by one.
  3. save the attachment.

Correct?

1 Like

yes. but the 1 st country name is argentina. and the mail argentina will eventually go down when other mails comes. so I am getting paused here

1 Like

So can you tell me how many mails will be there for one Country?

1 Like

two for argentina, 2 for chile, 4 for colombia. and so on… mails for countries changes

1 Like

Hi @abivanth.r ,

Try the workflow below; maybe, it will help you. Feel free to ask any questions.

Main.xaml (31.5 KB)

Regards,
Vinit Mhatre

1 Like

Hi


Getting this error.

1 Like

Hi @abivanth.r ,

Entire workflow:

Get Outlook mail property:
image

Regards,
Vinit Mhatre

1 Like

image
Getting this error at read range

1 Like
  1. Check excel path
  2. Check Sheet name
  3. Check Range
1 Like

Thanks for the help!
Worked :blush:

1 Like

Can I get the Attachments saved in a new folder?
EX: Argentina has 2 mails and each contain 2 attachments. that 4 attachments need to be saved in a folder.
then for chile it has 2 mails and it contain 2 attachments as well. i need to put them in a seperate folder.
like this i need to do it for all country.
is it possible? if it is please help me up
cheers :handshake:

1 Like

Hi @abivanth.r ,

Yes you can do that also, just add one condition inside for each as below, it will check every time if folder is exist or not, if not then it will create a folder according to the country name

If condition:

path.Exists("Output\"+item("Country Name").ToString)

At last just pass the “Save_path” variable into save attachment
image

Regards,
Vinit Mhatre

1 Like

Hi
The if is little confusing. Can you please share the .xaml

1 Like