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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to Automate Saving...
Power Automate
Answered

How to Automate Saving Email Attachments to OneDrive and Refresh Power BI Dataset?

(1) ShareShare
ReportReport
Posted on by 932 Super User 2024 Season 1

I have a specific requirement and need some guidance. I'd like to set up a flow in Power Automate that does the following:

  1. Monitors my inbox for emails with the subject line "Monthly Finance Data".
  2. If such an email has an Excel attachment, I want the attachment to be automatically saved to a specific location in my OneDrive.
  3. After saving the attachment, I'd like this action to trigger a refresh of a particular dataset in Power BI.

Has anyone implemented something similar or can provide steps or resources that can guide me in setting this up?. 

 

Thanks in advance for your help!

Categories:
I have the same question (0)
  • trice602 Profile Picture
    16,135 Super User 2026 Season 1 on at

    Hi @HamidBee ,

     

    I think this will work for you, please let me know.

     

    trice602_0-1699029864453.png

     

    Next apply to each (in case there is more than one attachment).  Dynamic content is attachment name and attachment content bytes - fyi

     

    trice602_1-1699029912436.png

     

    Last step, I refresh a desired dataset.

     

    trice602_2-1699029974054.png

     

    Here's the entire flow.

     

    trice602_3-1699030035451.png

     

     

     

  • HamidBee Profile Picture
    932 Super User 2024 Season 1 on at

    Thanks for getting back to me. I have built the flow using your suggesting and tried testing it unfortunately I'm getting an error when trying to create a file in OneDrive. Here is the error message:

    Request-URI Too Long - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
    <HTML><HEAD><TITLE>Request URL Too Long</TITLE>
    <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
    <BODY><h2>Request URL Too Long</h2>
    <hr><p>HTTP Error 414. The request URL is too long.</p>
    </BODY></HTML>

     

    I am trying to save the Excel file in a OneDrive folder I have called "OneDriveFiles". So I set the folder path to:

    /OneDriveFiles

    Any advice would be greatly appreciated. Thanks in advance. 

  • trice602 Profile Picture
    16,135 Super User 2026 Season 1 on at

    Hi @HamidBee ,

     

    I don't think the folder name is the issue, I also created and saved here.  The issue most likely is the file name length.  Can you share what the file name is please?  I'm guessing the file name is long?

     

    trice602_1-1699033783856.png

     

     

  • HamidBee Profile Picture
    932 Super User 2024 Season 1 on at

    Yeah sure. When I tested the flow I sent an email to myself with the document attached. The document name is called "SampleSalesData.xlsx" and the subject line is "Monthly Finance Data".

  • trice602 Profile Picture
    16,135 Super User 2026 Season 1 on at

    I will test over here.

  • trice602 Profile Picture
    16,135 Super User 2026 Season 1 on at

    Hi @HamidBee ,

     

    I didn't get any errors.  Can you please share your expanded flow actions?  Here's my results (I've removed the Power BI refresh action for this test):

     

    trice602_0-1699034298010.png

     

    trice602_1-1699034352514.png

     

     

    My hunch is your create file name dynamic content.  Please share.

     

     

  • HamidBee Profile Picture
    932 Super User 2024 Season 1 on at

    Here are the screenshots:

    pic1.png

    pic2.png

    pic3.png

  • trice602 Profile Picture
    16,135 Super User 2026 Season 1 on at

    Hi @HamidBee ,

     

    Please look at your output of create file and look at the path.  What does it say?

     

        "body": {
            "Id""b!c-eQ6V7Dm0mLW7e5hrm6-YjXYGqIH39GtO407tayRriMdclbe36MQLBfuaNjicOD.01AJ5LOPNEBUIJ7CLYTZAINIVCLOYR3PBI",
            "Name""SampleSalesData.xlsx",
            "NameNoExt""SampleSalesData",
            "DisplayName""SampleSalesData.xlsx",
            "Path": "/OneDriveFiles/SampleSalesData.xlsx",
     
    Next, let's check all the values:
     
    1)  trice602_0-1699035595424.png

     

    2) 

    trice602_1-1699035627765.png

     

    3) 

    trice602_2-1699035654818.png

     

    Sorry, I've been unable to duplicate to error.

     

     

  • HamidBee Profile Picture
    932 Super User 2024 Season 1 on at

    Sure. Hers is the output from the "Create file":

    {"statusCode":414,"headers":{"Cache-Control":"no-cache","Pragma":"no-cache","Transfer-Encoding":"chunked","x-ms-request-id":"06be5fc6-0fce-42a1-a00a-67b30376a04b","X-AspNet-Version":"4.0.30319","X-Powered-By":"ASP.NET","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","x-ms-apihub-obo":"false","Date":"Fri, 03 Nov 2023 18:06:36 GMT","Content-Type":"application/json","Expires":"-1"},"body":{"status":414,"message":"Request-URI Too Long - <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"http://www.w3.org/TR/html4/strict.dtd\">\r\n<HTML><HEAD><TITLE>Request URL Too Long</TITLE>\r\n<META HTTP-EQUIV=\"Content-Type\" Content=\"text/html; charset=us-ascii\"></HEAD>\r\n<BODY><h2>Request URL Too Long</h2>\r\n<hr><p>HTTP Error 414. The request URL is too long.</p>\r\n</BODY></HTML>\r\n","source":"api.connectorp.svc.ms"}}
     
     
  • Verified answer
    HamidBee Profile Picture
    932 Super User 2024 Season 1 on at

    Okay so I managed to get the flow to run successfully. For the action "Create file" I set the following settings:

    File Name: Attachments Name
    File Content: Attachments Content

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 552

#2
Valantis Profile Picture

Valantis 388

#3
11manish Profile Picture

11manish 375

Last 30 days Overall leaderboard