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 / Extract excel file fro...
Power Automate
Suggested Answer

Extract excel file from within an email body (URL)

(1) ShareShare
ReportReport
Posted on by 40
I am looking for a simple way to extract an excel file that is delivered each day in the body of an email as a URL link. I would like like to save the excel file from the link to a onedrive folder and rename it. Saved file name I am looking for us..,.
 
YYYYMMDD - Extract
 
Any suggestions 
Categories:
I have the same question (0)
  • Suggested answer
    stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    I can provide some structure, you can figure out the detail by yourself
     
  • Leschkeb Profile Picture
    40 on at
    @stampcoin I have misinterpretted the link in my email... although the resulting file download is excel, that file is created from the download location when clicked.
     
    The url format in the body of my email is..
     
    insertdomain.com/export/download?exportID=356&token=3****LM2u.PIrXeMBMxuc.pl/jOqITOgnYkLIC573THHX.cPvtw8LKlAiC&user=PADSTBFg1X9uRNMCjlKvqelm95LzPO
     
    This is what i want to 'activate' in the flow to then direct the download to my onedrive folder with the approprate naming convention.
     
    Any advice? Appreciate your input so far!
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    I think you have everything, what you need is :
    1. capture the link. ( before you may need to convert the email from HTML to text)
    2. use HTTP connector , GET method, Authentication: None(you already have the token in the link according your description).
    3.  give the file a name 
    4. download.
    you'll be there.😊
  • Leschkeb Profile Picture
    40 on at
    @stampcoin I am completely confused. Been goig in circles in the last 24 hours. I have no code experience, so I am unsure how to interpret your advice and have no idea how the syntax of the code works. If I shared some screenshots would you be willing to assist me futher?
     
    These are the actions I have loaded. I can also provide the full text of the email body if that helps.
     
     
    Thanks for considering!
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    Please share the compose input and output.
    we can start from there.
  • Leschkeb Profile Picture
    40 on at
    Thank You. I have also included the first few steps in the event i don't have the syntax correct.
     
    Step 1 - When a new email arrives
     
     
     
    Step 2 - Html to text
     
     
     
    Step 3 - Initiallize Variable
     
    Step 4 - Compose
     
     
    Compose - Code View
     
     
     
     
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    Your first compose target should find the link within the email.
    for example.
    match(outputs('HTML_to_Text'),'https?:\\/\\/[^\\s"]+\\/export\\/download\\?[^\\s"]+')
    match() returns an array; the regex looks for your exact path pattern.
     
    The regex in the first compose stops at the first whitespace or quote mark, so it grabs the full query-string—including your long token= value—even if it contains additional “&” parameters.
  • Leschkeb Profile Picture
    40 on at
    I have tried to update the compose, by interpreting what you mean. I have tried the following:
     
    First I tried to copy the script you mentioned
     
    match(outputs('HTML_to_Text'),'https?:\\/\\/[^\\s"]+\\/export\\/download\\?[^\\s"]+')
     
    Then I tried to build the script using the insert expression icon a d seleting the html to text as the output from the previous step.
     
    match(body('Html_to_text'),'https?:\\/\\/[^\\s"]+\\/export\\/download\\?[^\\s"]+')
     
     
    But i received an error.
     
     
     
    If it helps the output of the html to text is below (highlighted yellow the url I am seeking)
     
    --------------------------------
     
     
    Your export of Export-20250511- -Report is complete

    CAUTION: This email originated from outside the organisation. Do not click links
    or open attachments unless you recognise the sender and know the content is
    safe.


    --------------------------------------------------------------------------------

     

         
    [https://image-tracking-service.au-1.mimecastcybergraph.com/v1/image?imageData=31%2BSCXb2yDhlVh2jCChBAcHdW%2FTtf%2FcFrWcKob7fYIA2pYj9AVqhqPN93s6EaMahLHvpAKxQaeRyDnJSM8taJWAHEIMKB9xvQHplv1%2BAoHx3RS%%2BYYWVyIM6HiQ45Y1xiXue0nO%2Bz48mXr0uv2Bgc6uvaa5l5QEcBmb6CgwGiKRKzkpFPpYwJEgCELsx]
    The xxxxxxxxx
    229 Elizabeth Street, xxxxx, AAA 0000
     
    Hi leschkeb,

    Your export, Export-20250511-Member-Report, is complete.

    Click here to download the file
    [https://domain.com/export/download?exportID=395&token=3**zyKdKar6c8VrY9Ktogx2P.0UaSd0I5lYL.XcEguoDwGtQ8k6lfYye&user=PTBFg1X9uRNMCjlKvqelm95LzPOrzK7pMujzQ2KuFot7tlWp7h]
     

    Questions? Email the Engineers at help@domain.com.

         

     

     [https://image-tracking-service.au-1.mimecastcybergraph.com/v1/image?imageData=eBdzi4Bk4p1oerS6qJtgDkx4TX0F6x7gfpoBBoYo3D%2Fpnv0M1t3iIv%2Fq%2B1YyReEnd8kJO9knmomcOv5uRMdzPMHRxvDUtiHnFom3v4ueZq4YW%2Bo9zyVk49kIXwf%2BxUp9qcoB6ky3daJSlabNHYHFBpT2VKqiM%2FK2rK%2FrcQF9lqaPidaurkOE%3D]
    [https://domain.com] 

     

    [https://image-tracking-service.au-1.mimecastcybergraph.com/v1/image?imageData=%2FbPYri8ARqF5U%2BaZ0LtV4H0ro7fqL2r2TFWY5%2BeJ3mIIMMC4ebqK1DmzkzYfH%2BwCfAGiBX0ZIPHNyJAfLyiC7t2rSRh3s0%2F3WUdYjb5PLDTaPsVC%2F8On0HgM9XM3U0%2FtLI%2BIp95tySrF9m8Ebcn8Mpd6GOPRCp5Myq4Qy6%2B%2BAujgA9ZABE4cGzE35uNtXqYLA0DmrZdCQYpX%2FCPi%2BaONproWFVadpnqp8lg8w5RCTrISEVEAbYAMKmD5xDz%2Fu67hf4kHS6s58%3D]

     
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
     
    Sorry, I didn't expect you copy the code, it's not a real code.
    you can copy below one for the compose
     
    if(
      contains(body('Html_to_text'), '[https://domain.com/export/download?'),
      concat(
        'https://domain.com/export/download?',
        first(
          split(
            last(
              split(body('Html_to_text'), '[https://domain.com/export/download?')
            ),
            ']'
          )
        )
      ),
      ''
    )
     
  • Leschkeb Profile Picture
    40 on at
    I successfully generated the output in the first compose - see shot.
     
     
    If i copy and paste this manually into the browser the link downloads my excel file into my download folders, so the link is correct.
     
    For the next step - is this the arrany?
     
    My attempt wasn't viable
     
     
    Kept getting an error.

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 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard