My current flow is as follows but my Excel file that is created is corrupt and no delete of the file?
Hi @AZB0105
Thank you for reaching out.
I understood that when you receive an e-mail with a file attached and after checking a condition, you firstly want to delete an already existing file in OneDrive and proceed to create a new one containing the attached file from the email.
Currently, the file is not being deleted (issue 1) and the Excel that you create is corrupted (issue 2).
I tried to reproduce the errors on my side and I found that:
Issue 1: Delete of the statically specified file Report (2).xls
I was able to delete the file with no problem. Using the folder icon in the File textbox, I manually chose the file in OneDrive I wanted to delete, and then made sure the file was actually placed in that directory in OneDrive.
If you still encounter the same behaviour, please try to delete and create the action again.
Issue 2: Created Excel from Email attachment is corrupted
Currently, Power Automate does not allow for the creation of an Excel file in OneDrive passing on directly the dynamic content "Attachment Content" to the "Create file" action. A workaround might be to use the "Get attachment (V2)" action after receiving the email and then use the "Content Bytes" dynamic content from that action, when creating the OneDrive file.
Below is a flow example:
Please, note that this implementation only works when you receive 1 attachment on the e-mail. The action "Get Attachment (V2)" will prompt the use of the "Apply to each" control action to check every attachment on the received e-mail.
In case you receive more than 1 attachment, by the time the flow is processing the 2nd attachment, it might fail because the file Reports (2).xls has been already deleted.
To get around this, you can make sure that you only process email's containing 1 attachment, using a condition as I did in the above flow.
Otherwise, the template @abm suggested might also be an option.
Looking forward for your reply.
Best regards,
Manuel Nunes
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
WarrenBelz
146,635
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional