Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

Power Automate creating corrupt xlsx files

(1) ShareShare
ReportReport
Posted on by 6
Hi all
 
I have a flow that gets a .xlsx from a form, before checking if a specified file exists in sharepoint. If the file doesnt exist, it creates it, otherwise it updates the existing file. Finally, it emails the same file to a specified address.
 
Techically, the flow works and completes fine. However, the .xlsx files that it creates are corrupt, and open with the error: "Excel cannot open the file xxx.xlsx because the file format or extension is not valid. Very that the file has not been corrupted and that the file extension matches the format of the file.
 
The form data comes in as a .xlsx via a HTTP request to sharepoint, and isnt changed through the flow. I have so far re-created the create and update nodes , turned off chunking, checked and re-checked the file extension etc,. Any ideas?
 
The part of the flow in question is currently:
Open to all suggestions. Cheers
  • Suggested answer
    Nived_Nambiar Profile Picture
    Nived_Nambiar 17,115 on at
    Power Automate creating corrupt xlsx files
     
    Sorry, i just have tried the api and used create file and update action- it is working fine and file is not getting corrupted.
     
    See below on how i created and updated the file FormResponses.xlsx
     
    This action checks whether the file with name FormResponses.xlsx exists or not ?
     
    Now use a condition action which validates whether the file exists or not using output from above action.
     
     
    Expression used for this --  length(outputs('Get_files_(properties_only)')?['body/value'])
     
     
    If the condition is true (Yes branch)
     
    if condition is false, then follow No branch
     
    Expression used - 
    first(outputs('Get_files_(properties_only)')?['body/value'])?['{Identifier}']
     
     
     
    This would work !
     
    Thanks & Regards,
    Nived N 
    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs
     Found my answer helpful? Please consider marking it as the solution!
     Your appreciation keeps me motivated. Thank you!

     
  • KM-31071426-0 Profile Picture
    KM-31071426-0 6 on at
    Power Automate creating corrupt xlsx files
    The form data is just a .xlsx, retreived using the "send a HTTP request to sharepoint" to send a GET to https://forms.office.com/ with the URI being /formapi/DownloadExcelFile.ashx?formid=MyFormID.
     
    Essenaitlly, Im happy for the data in the xlsx on sharepoint to be overritten every time, as the only change will be the newest reponse to the form, which gets tacked on in a row undernearth any existing rows.
     
    I've had a look at the excel functions but cant get it to do exactly what I want, though im sure there is a way.
     
    I also get corrupt excel files using the "create file" and filling with the body of the HTTP request, which has worked for me before on OneDrive but is failing in Sharepoint.
  • Nived_Nambiar Profile Picture
    Nived_Nambiar 17,115 on at
    Power Automate creating corrupt xlsx files
     
    Well i feel that using update file action is not needed instead , you should have tried excel actions in power automate where it adds row to excel table if exists.
     
    could you share about form source - what format it is retrived from http request from sharepoint ? That would be helpful :)
     
    Thanks & Regards,
    Nived N 
    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs
     Found my answer helpful? Please consider marking it as the solution!
     Your appreciation keeps me motivated. Thank you!

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,691

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 65,019

Leaderboard