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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Send an email (V2) add...
Power Automate
Answered

Send an email (V2) adds Base64 when I don't want it to.

(1) ShareShare
ReportReport
Posted on by 16
   I am trying to send an xlsx file via email. I generate the Excel file from Paginated Reports. I can save as an xlsx to my OneDrive. But, when I try to send it as an email attachment, it gets encoded and I can't open it.
 
This is what the code looks like:
   "emailMessage/Attachments": [
        {
          "Name": "fasd.xlsx",
          "ContentBytes": "@{base64(body('Export_To_File_for_Paginated_Reports'))}"
        }
 
It keeps adding the base64
 
 
Here is what I think I want it to look like:
 "emailMessage/Attachments": [
        {
          "Name": "fasd.xlsx",
          "ContentBytes": "@{body('Export_To_File_for_Paginated_Reports')}"
        }
 
Categories:
I have the same question (0)
  • KK79 Profile Picture
    6 on at

    I'm experiencing exactly the same issue.
    I select the file content, like the below printscreen.

    KK79_0-1701347393500.png

     

    After saving, this changes to base64.

    KK79_1-1701347466668.png

    The excel file is being send but cannot be opened.
    KK79_2-1701347591490.png

     

  • l1l1l1l1ld Profile Picture
    16 on at

    Thank you for the confirmation. It looks like it is adding base64 encoding to any attachment - even if you type in a randomname.pdf ... it adds base64 encryption. 

  • Ugambino Profile Picture
    23 on at

    Having the same issue, is there a way to bypass this?

  • rw_ga Profile Picture
    137 on at

    Have you tried adding base64ToBinary() to the content?

     

    Ex: base64ToBinary(body('Export_To_File_for_Paginated_Reports'))

     

    Does this work for you?

     

    rw_ga_0-1701367034778.png

     

    Do you know how the file is encoded from the action above the send email action? Maybe it is already in base64???

     

    if base64ToBinary() doesn't work try base64ToString() to convert it to String.  Just some thoughts.

  • rw_ga Profile Picture
    137 on at

    Another thought is to just use string() instead of base64ToString, because base64ToString() I think actually decodes the base64 value.

     

    Here is some information I found helpful when I was working with files and flows.

     

    Working with Files and File Contents in Power Automate (encodian.com)

    Handle Base64 and Binary File Content Types in Power Automate (linnzawwin.blogspot.com)

    Solved: Re: Create a .csv file that uses UTF-8 character e... - Power Platform Community (microsoft.com)

     

  • rw_ga Profile Picture
    137 on at

    I usually store all my email attachments in an 'append to array variable' called emailAttachments. I've had to use different structures depending on how the content is returned by the action retrieving or creating the file.  Examples below:

     

    {
    "Name": "FILENAME HERE",
    "ContentBytes": {
         "$content-type": "MIMETYPE GOES HERE",
         "$content": "DOCUMENTBODY GOES HERE"
    }

     

    or 

     

    {
    "Name": "FILENAME GOES HERE",
    "ContentBytes": FILECONTENT GOES HERE
    }

     

    Then click on the "Switch to input entire array" option in the send an email action.

     

    rw_ga_1-1701369185411.png

     

     

    rw_ga_0-1701369088633.png

     

    Add multiple attachments to an approval email with Power Automate (tachytelic.net)

     

    It seems like I always have to test and research when working with files. Knowing how the file is retrieved or created helps tremendously though so you may have to determine that before finding your correct fix.

     

  • Ugambino Profile Picture
    23 on at
    I have tried a couple of methods, even direct file contents,
    I'm able to create an HTML table and use it in the body of the email without problem and create a SharePoint file with .CSV, even if i want to extract the content directly from the SharePoint file when I press Save it just changes again to Base 64. tried getting the information in a variable and the same result, tried parsing the file via power automate and then using the parse and the same thing.
    I don't know what else to try?Ugambino_0-1701369619588.pngUgambino_1-1701369649456.png

     

     



  • Verified answer
    rw_ga Profile Picture
    137 on at

    I believe they updated the editor recently, I wonder if that's the issue. I'm still accessing my flows via: https://make.powerapps.com/ drilling down to the solution > cloud flows > editing the flow here and get to use the older editor.

     

    Is your flow in a solution?  Maybe try editing it with the older editor.

  • Ugambino Profile Picture
    23 on at

    It's been like 3 days trying to figure it out, OMG this actually worked using the older editor.

    Thank you, for giving me some light 🎉

  • rw_ga Profile Picture
    137 on at

    Wow, I just tried the new editor for testing and it does seem to wrap anything I put in the "Conent - x" field with bases64() as you indicated. Wonder if thats a bug???  If so, you probably shouldn't edit that flow with the new editor until it gets fixed!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 315 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 273 Super User 2026 Season 1

#3
Power Platform 1919 Profile Picture

Power Platform 1919 117 Super User 2026 Season 1

Last 30 days Overall leaderboard