corrupt .xlsx file in sharepoint for a file created in a automate flow

Anonymous
2023-08-23T16:55:52+00:00

Hello,

I am trying to create a excel file using a template and script. The file is saved in sharepoint and then sent out in an email.

I create a flow to perform these tasks. and the flow works and the file and emails are processed. However I am not able to open the .xlsx attachment.

The error opening on the attached .xlsx file in the email is "Excel cannot open the file ******.xlsx because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file. "

The error opening through sharepoint is " This workbook couldnt be opened because the file format may not be matching the file extension"

These are the flow steps:

Associate enters results in a form.

Flow

Step 1 Get responses

Step 2 Add rows to table ( not using table currently - will be at a later date)

Step 3 Get file metadata from a template I created ( have tried get the file for excel worksheet and also File from Sharepoint)

Step 4 Create a file into SharePoint folder

Step 5 Run Script

Step 6 Get File Content

Step 7 Send Email

Whichever way I create this Flow. Get data from sharepoint template, excel template, or one drive. I keep getting the same error message when trying to open the .xlsx file attached on the email and opening through sharepoint .

I have checked the file extension. Access to the files were granted, etc.

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2023-08-24T01:37:11+00:00

    Here are the four possible causes we’ve gathered behind this error message:

    • Compatibility Issue
    • Unsupported File Format
    • Corrupted Excel File
    • Insufficient Permissions

    I am not familiar with power automate, our category focus on excel function, we’d suggest you go to Microsoft Power Automate Community - Power Platform Community to post a new thread, which is the specific channel to handle Office script issue. Hope they can find the cause of your issue.

    Thank you for your understanding.

    0 comments No comments
  2. Anonymous
    2023-09-25T13:40:10+00:00

    Hello,

    I had a similar issue with one of my script.

    After the flow ran the script, the Excel file wouldn't open and the corrupted file message would come up.

    My script is very simple.

    Among other things, it renames the columns in a table.

    When I recorded it, and edited the first column header, renamed it, and then changed the other columns using autofill because I rename the columns to Column1, Column2, Column3, etc.

    I will spare you the troubleshooting actions, but my investigation brought me to the conclusion that that the "autofill" function was creating the problem, I created a script which edited and renamed each column individually instead of the autofill function.

    That resolved the issue.

    So I would advise to review your script and remove anything that is similar to autofill in nature and just use the basic commands.

    Hope this helps.

    Regards,

    0 comments No comments