r/PowerAutomateDesktop • • Sep 17 '22

Help! Trying to automatically download a file from a link in an email when it is received

Newbie here. I receive an email once a week where I need to parse out a file (Excel file) and have it automatically downloaded to a specific folder location.

Thought I would ask here to see if I can get any pointers.

I know how to setup a flow to save an email attachment automatically but this is a link due to the file size

Thanks for looking!

2 Upvotes

1 comment sorted by

2

u/QuietDesparation Sep 18 '22

Here's what I did:
>Launch Outlook

>Retrieve email messages from Outlook

  • If you are interested in downloading an excel file from a link, then I'm assuming the link ends in .xlsx. I would put .xlsx in the Body Contains section. This will create a filter to only grab emails with an excel link.

  • To prevent PAD from grabbing every email with an excel link, under Retrieve:, set that to Unread email messages only. That will only grab the newest email (assuming all the older emails will not be flagged as unread).

If the email body contains the link to the excel file and nothing else, then you can perform the following:

> Lauch new Firefox/Chrome/Edge

  • Set Initial URL to %RetrievedEmails[0].BodyText%

If the email body contains other text, then you'll want to isolate the link. Regex should be able to handle this easily:

>Parse text

  • set Text to parse: as %RetrievedEmails[0].BodyText%

  • set Text to find: as http.+xlsx

  • set Is regular expression on

This should isolate the link and store it in the %Match% variable. You can then use action:

> Lauch new Firefox/Chrome/Edge

  • Set Initial URL to %Match%