How to Fix Invalid File Format Errors for Excel in Power Automate
Question details
The user needs to resolve an issue where an Excel file transferred via a Power Automate flow cannot be opened due to an invalid file format or extension error.

- Product
- Power Automate / Microsoft Excel
- Device & OS
- not provided
- Scenario
- Automating the transfer of Outlook .xlsx email attachments to a SharePoint folder using a Power Automate workflow.
- Observed behavior
- The Power Automate flow reports a successful run, but the resulting Excel file in SharePoint is corrupted and fails to open, displaying an invalid file format or extension error.
Verify the original .xlsx attachment from the Outlook email opens correctly before it is processed by the flow, to rule out a corrupted source file.
Map the Correct Attachment Content Bytes in the Flow
Ensure that the actual binary content of the attachment is mapped to the 'Create file' action, rather than file metadata like the display name.
When a Power Automate flow copies an Outlook attachment to SharePoint, selecting the wrong dynamic content for the file body will corrupt the resulting file. The flow will report a successful run, but Excel will fail to open it due to the invalid format.
Open your Power Automate flow, locate the 'Create file' or 'Update file' SharePoint action, and click to edit it.
Click into the 'File Content' field. From the Dynamic Content menu, select 'Attachment Content' (or 'Content Bytes') from the Outlook trigger, avoiding fields like 'Name' or 'Id'.
Ensure the 'File Name' field accurately reflects the source file name and dynamically includes the .xlsx extension.
Save your flow and trigger a new test run. Navigate to your SharePoint folder and attempt to open the newly generated Excel file.

Decode Base64 Attachment Content
If your flow receives the attachment as a Base64 encoded string, you must convert it to binary format before saving it to SharePoint.
Consult the Power Automate Community
If standard mapping and decoding do not resolve the formatting error, the issue may stem from a connector bug requiring community expertise.
Open and Edit Your Spreadsheets Seamlessly with WPS Office
Since Power Automate formatting issues require specific workflow configuration fixes, you might still need a reliable tool to handle your daily spreadsheet tasks locally. WPS Office is a highly compatible, free alternative that lets you open, edit, and save Excel files smoothly without heavy subscription costs.
- 1. Download WPS Office: Visit the official WPS website to download and install the free WPS Office suite.
- 2. Open Your Spreadsheet: Launch WPS Spreadsheet, click 'Open', and select your locally saved .xlsx file.
- 3. Edit and Save: Make your necessary edits and easily save the file in its original format.

Frequently Asked Questions
Why does Power Automate report success but the Excel file is corrupt?
Power Automate reports a 'success' status when the workflow actions execute without technical errors. However, if the flow was configured to write text metadata instead of binary file content to the file, the creation action still succeeds, but the resulting file structure becomes an invalid format for Excel.
Can I use Power Automate to extract CSV attachments instead of XLSX?
Yes. Extracting CSV files follows a similar flow configuration. Since CSVs are plain text files, they are generally less prone to binary corruption issues compared to XLSX files, as long as the text encoding (like UTF-8) is handled properly.
How do I check if my Excel attachment is corrupted before the flow runs?
Go directly to your Outlook inbox, download the .xlsx attachment locally, and try opening it in an application like Excel or WPS Office. If the file opens successfully, the issue lies entirely within the Power Automate flow configuration, not the source file.




