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 / File Error when trying...
Power Automate
Unanswered

File Error when trying to save email attachment (xls) to OneDrive

(1) ShareShare
ReportReport
Posted on by 63

I am trying to set up a flow to save an excel attachment to a OneDrive file when received. When it saves to the folder, it's not saving as .xls or .xlsx. When I add either extension to the File Name within the flow, the data is corrupted. What can I do to fix this?

Categories:
I have the same question (0)
  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @gillgamm To make the flow dynamic, you shouldn't hard code the file extension. You should take the original file extension and append it to the end of the file name. I cover how to do that in this YT tutorial: Save Email Attachments to SharePoint with Microsoft Power Automate

     

    Power Automate doesn’t have a download attachment from outlook action. In this Power Automate Video tutorial, I’ll show you how to use the Get Attachment (V2) action in combination with the Create File action to get your email attachments onto SharePoint. The Create File action will overwrite any files that already exist with the same name. In this tutorial, I’ll show you how you can append a timestamp to the end of a file name to prevent your file from being overwritten.

     

    I’ll also show you how to set up your flow so that you can trigger it manually while building it so you don’t need to wait for an email to arrive. At the end of the video I’ll show you how adding trigger conditions to your flow can prevent it from triggering if certain conditions aren’t met. Although the final flow uses the When a new email arrives in a shared mailbox (V2) trigger, you can use any of the When a new email arrives triggers for your flow. Adjust this flow to suit your needs!

     

    IN THIS VIDEO:

     How to Automate Downloading and Uploading Email Attachments to SharePoint

     How to Use a the Get Email (V2) action

     How to Use the Get Attachment (V2) action

    How to Create Attachment Files using the Create File Action

     How to Prevent the Create File Action from Overwriting a File

     How to use Split the Filename from its Extension

     How to Append a Timestamp to a File Name

     How to use the When a New Email Arrives in a Shared Mailbox (V2) trigger

     How to use the Convert Time Zone action

    How to add Trigger Conditions to your Flow

     

    ---

     

    Also, to prevent your flow from triggering every time a new email arrives and only trigger your flow when a specific email meets your criteria, you should consider using Trigger Conditions in your flow.

     

    Check out this YT Tutorial for more details on how to add Trigger Conditions to your flow: 4 Ways You Can Use Trigger Conditions in Your Microsoft Power Automate Flow

     

    If you are using an Automated Cloud flow trigger in your flow—you need to consider adding trigger conditions.

    Do YOU 🫵 know what a trigger condition is? Trigger conditions can be set in most flow triggers. These conditions you set must be true for the trigger to fire. In this Power Automate tutorial, I’m going to show you how to use trigger conditions in your flows to control when your Power Automate flows trigger.

     

    If your plan has flow run limits—you can avoid triggering your flows unnecessarily by using trigger conditions.

    I’ll cover four different flow examples that would benefit from trigger conditions:

     

    ️ Triggering a flow when a column is changed to a specific value

    ️ Triggering a Flow When an Event Updated or Deleted

    ️ Triggering a Flow When a New Folder is Created

    ️ Triggering a Flow When a Specific Email is Received I’ll also show you a trick on how to easily create the expressions needed and give you a few tips on how to troubleshoot your flow.

     

    IN THIS VIDEO:

     Four different flows that would benefit from trigger conditions

     What is a trigger condition?

     How to add a trigger condition to your flow

     How to trigger a flow when a column is changed to a specific value

     How to trigger a flow when an event is updated or Deleted

     How to trigger a flow when a new folder is created

     How to trigger a flow when a specific email is received

     How to troubleshoot a trigger condition

     How to prevent case sensitivity issues with a trigger condition

     How to use the filter array action to easily compose an expression that can be used in a trigger condition

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @gillgamm 

     

    The reason for the corruption is you need to convert the attachment content to base64ToBinary(). 

     

    Follow the below steps:

     

    image.png

     

    Above expression is as follows:

     

    base64ToBinary(outputs('Get_Attachment_(V2)')?['body/contentBytes'])
     
    Thanks
  • gillgamm Profile Picture
    63 on at

    I tried the solution but the file is still saving the file this way when it is an Excel attachment.

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @gillgamm 

     

    I tried this and it did worked perfectly for me.

     

    Thanks

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Try downloading that excel file from email and see if that opens fine or not.

     

    Thanks

  • gillgamm Profile Picture
    63 on at

    The file downloads and opens correctly directly from the email, just not when it's saved to the OneDrive file through the flow.

  • Verified answer
    gillgamm Profile Picture
    63 on at

    I did try using the csv extension in the file name and it seemed to work when saving the attachment file through the flow.

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard