I am currently working on a Power Automate flow where the objective is to automate the handling of email attachments.
The flow is designed to work as follows:
- The flow is triggered every time a new email arrives with attachments.
- The attachments are extracted automatically from the email.
- The extracted files are then saved into a specific folder in SharePoint.
The flow runs successfully without errors, and the files are created in the SharePoint library as expected. However, I am facing an issue specifically with Excel files (.xlsx).
When I try to open the Excel file directly from SharePoint, I receive the following error message:
"This workbook couldn't be opened because the file format may not be matching with the file extension."
This behavior suggests that although the file is saved with the correct .xlsx extension, the actual content of the file appears to be corrupted or does not match the expected Excel format.
The same file opens correctly when it is downloaded directly from the original email attachment, but not when it is generated through the Power Automate flow and stored in SharePoint.
At this point, I am not certain what is causing the file corruption. The issue may be related to how the attachment content is being retrieved or passed into the "Create file" action in SharePoint (for example, using an incorrect attachment content field such as contentBytes instead of the correct attachment content output).