web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Automatically download...
Power Automate
Unanswered

Automatically download a file that is in an url link inside the e-mail

(0) ShareShare
ReportReport
Posted on by 289

Hi Community,

 

I need to automate a process. Below is the story what I need to automate.

 

When an email is received, inside the e-mail, it contains a "Download" button. I need the automate the process where when the e-mail is received, it automatically download the file within the e-mail by clicking the "Download" button that connects to an url and save the downloaded file in a particular folder.

 

Any resources/documentation on how to achieve this either through Power Automate or Power Automate Desktop will be great, thank you. 

Categories:
I have the same question (2)
  • Paulie78 Profile Picture
    8,422 Moderator on at

    Quite an interesting question. Before getting into details, do you have a premium license?

  • lliu_western Profile Picture
    289 on at

    @Paulie78  I do.

  • Paulie78 Profile Picture
    8,422 Moderator on at

    It's straightforward apart from extracting the link from the html. Do you have a sample of the HTML?

    You can change the download link to something else if it is confidential.

  • lliu_western Profile Picture
    289 on at

    @Paulie78  I don't know how much I can post on here publicly. But after looking at the html code email, the link is embeded like this below:

     

    originalsrc="https://api.link_exmaple"

     

    and I just need to extra the file from https://api.link_example, which when load the link itself, it will download the file itself.

  • Paulie78 Profile Picture
    8,422 Moderator on at

    Downloading the file is as easy as this:

    downloadFile.png

    You can then take the HTTP output and do whatever you want with it (save it to a folder). Your challenge is going to be grabbing the URL from the HTML. 

     

    I can make an expression that gets the URL from the sample you posted. But it is very unlikely to work when you try it against your own proper example.

     

  • lliu_western Profile Picture
    289 on at

    @Paulie78  Awesome, this is problem exactly when I will need.

     

    I am thinking the first step of the flow is

    1. when the e-mail account receives an email.

    2. A condition, if the sender = the particular sender

    3. extra the link from the e-mail; which the unique key in the e-mail will be "https://api......"   

    (the text of https://api  is used in that link only, so I just need to create a string that extra the content between the quotation once it finds "https://api" 

     

    then the rest of the steps will be what you posted above, I think. 

     

    any tips on extracting the link text? 

  • Verified answer
    Paulie78 Profile Picture
    8,422 Moderator on at

    No tips, just the expression:

    substring
    (
     substring(outputs('html'), indexOf(outputs('html'), 'https://api')), 
     0,
     indexOf(substring(outputs('html'), indexOf(outputs('html'), 'https://api')), '"')
    )

    linkIRL.png

    Result:

    linkURL-Result.png

  • lliu_western Profile Picture
    289 on at

    @Paulie78 

    lliu_western_0-1606959302085.png

    the output from the get should be an csv file. But when I attached the "http body" as the attachment in the email, and email myself (just testing if the download file works), it is not a csv file. I think I am doing something wrong from getting the csv file using http call? 

  • lliu_western Profile Picture
    289 on at

    @Paulie78 

    lliu_western_1-1606959566316.png

    this is the e-mail portion after http

     

  • lliu_western Profile Picture
    289 on at

    Got it working now. I used "Create file" after HTTP and where the input of giving the file name, just have to make sure the file content is correct. So in my case, the "File Name" input needs to be something like "FileName.csv" since it is a csv file. 

    lliu_western_0-1606964596963.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard