Skip to main content
Community site session details

Community site session details

Session Id : pvluwOhrMG3HlPP0oGXVfs
Power Automate - Building Flows
Answered

Save file attachment to Sharepoint Library causing file format not matching extension error

Like (0) ShareShare
ReportReport
Posted on 13 May 2024 13:08:13 by 21

Hi,

 

I'm sure I am missing something simple. I have set up an automation that identifies a regular email that I receive with data in an xlsx format file. This then saves the attachment to the correct folder I have set up. However, when I try to open this file it produces the following error:

"This workbook couldn't be opened because the file format may not be matching with the file extension."

 

This also means that other sheets that feed from this file are not being updated.

 

My flow is 

RhysWilliams_0-1715605212187.png

when a new mail arrives with "XYZ" in the subject, for each attachment, create file in "123" library with file name 

"name": "@item()?['name']",
"body": "@item()?['contentBytes']"
 
I've tried different "content" related options for content but none seem to be able to resolve the issue. 
  • RhysWilliams Profile Picture
    21 on 14 May 2024 at 09:36:29
    Re: Save file attachment to Sharepoint Library causing file format not matching extension error

    You beauty! Couldn't find any reference of the get attachment step in any posts I was following but it now works perfectly.

  • Verified answer
    ManishSolanki Profile Picture
    15,085 Super User 2025 Season 2 on 13 May 2024 at 13:23:50
    Re: Save file attachment to Sharepoint Library causing file format not matching extension error

    Hi @RhysWilliams 

     

    Firstly, switch to classic designer by toggle off 'New designer' on the top right corner:

    ManishSolanki_1-1715606476245.png

     

    Next, in the loop before "Create file" action add "Get attachment" action to get the content of the email attachment. Pass the message ID & attachment id as shown below:

    ManishSolanki_0-1715606171459.png

     

    Finally, add create file action to save a file in SharePoint. Pass the attachment name & content dynamically as shown below:

    ManishSolanki_2-1715606585290.png

     

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete