web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Keep getting "Cannot p...
Power Automate
Answered

Keep getting "Cannot preview file because it is corrupted" error when attaching file in email using Power Automate

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am Parse JSON my content and then filtering with Select and creating a CSV table from it because I want to send the content in Excel format. I want a new excel file to be created every time and then send that file through an email. In this case the email is being sent with the excel file attached but it shows the error "Cannot preview file because it is corrupted" (the create link step was just a trying attempt). Please tell me what I'm doing wrong

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I uploaded the pictures of what I'm trying to do

    MicrosoftTeams-image (6).png
    MicrosoftTeams-image (7).png
    MicrosoftTeams-image (8).png
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    The file extension should be .csv, and create file is not needed.

    vjefferni_0-1691565982355.png

    vjefferni_1-1691566021895.png

     

    Best regards,

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hey, it worked! But when I open the file, all the data get mashed into just one column. Is there an action or something I can do to fix this?

    MicrosoftTeams-image (9).png
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    I think this is due to formatting. Will it be in correct format when previewing in Outlook or Browser?

     

    Please try and use below expression as Attachment Content:

    concat(uriComponentToString('%EF%BB%BF'),body('Create_CSV_table'))

     

    Or you can try the create file method:

    vjefferni_0-1691575350520.png

    vjefferni_1-1691575366555.png

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Yea it does seem to be with formatting issue. I save it in my OneDrive and everything seems to be perfect but when opening through email it keeps on giving this issue with everything in just one column

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi, I am figuring that its because the excel im using using ; instead of , to seperate. Can you please tell me how i make this alterations in this case?

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Will all the users locate in EU countries? This setting relies on Windows regional setting if their Excel use default separator:

    How to change Excel CSV delimiter to comma or semicolon (ablebits.com)

     

    If all recipients need to use ; as the separator, then please refer to below thread, find the second solution:

    Solved: Change the delimiter when creating a CSV file - Power Platform Community (microsoft.com)

    vjefferni_0-1691633917938.png

     

    Finally I found a solution which is quite easy. You can add a Compose action, pressing Enter key inside to get the change line internal codes, and use the expression as file content in create file action:

    concat('sep=,',outputs('Compose'),body('Create_CSV_table'))

    vjefferni_1-1691634993729.png

    Here I was using ; to test, you need to use a coma instead.

     

    Then on my end the csv file is using semicolon as separator and all data goes into one column:

    vjefferni_2-1691635062223.png

     

    Best regards,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 317 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 247

#3
Henil Profile Picture

Henil 117

Last 30 days Overall leaderboard