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 / Store File content in ...
Power Automate
Answered

Store File content in a variable

(0) ShareShare
ReportReport
Posted on by 187

Hi, I'm trying to work out if it's possible to store the content output of 'get file content' in a variable. Have been trying to do this in a string variable and then add an attachment to an email with the variable in the 'content' part of the attachment but the attachment is not able to be opened when I receive the email.

 

 

Categories:
I have the same question (0)
  • ChristianAbata Profile Picture
    8,953 Most Valuable Professional on at

    hi @JamesSnaps  you can apend the variables.

    apend.PNG

  • Verified answer
    abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @JamesSnaps 

     

    Try the below.

     

    image.png

     

    Next you need to append the array with filename and content

     

    image.png

     

    Finally add your attachments in your email.

     

    image.png

     

    Note: If you file content type is binary then convert it using base64() expression. Here in my example I am using CDS database which is already getting the document in base64 format.

     

    Thanks

     

  • v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @JamesSnaps,

     

    Could you please share the configuration of your Flow by screenshots?

    I think the reason for the received email couldn't open the attachment is the content code format, you could refer to this similar post to learn how to convert the content into base 64 and try it again:

    https://powerusers.microsoft.com/t5/Building-Flows/Send-mail-with-attachment-when-a-new-message-and-file-posted-in/m-p/493138

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • JamesSnaps Profile Picture
    187 on at

    Many thanks, just tested this and works like a treat. Did have to convert to base64, but that's easy enough. Much appreciated.

     

    James

  • Gangula Profile Picture
    77 on at

    I'm facing a similar issue.

    I would like to use a variable to add "File Content" in the "Create file in SharePoint" step.

     

    But the "Dynamic Value" drop-down doesn't show the variable at all.

     

    Variables.jpg

    Create File.jpg

  • TValenzuela Profile Picture
    3 on at

    I wanted to reach out and see if you ever found a solution.  I'm in the same boat where I've created the array variable, appended the file name and content to the array, but when I go to the file contents filed the dynamic content for the variable is not there.

    Edit:  It seems this solution works for email where you can have the attachments field utilize the array.  However, using the array in other areas that are designated for "File Content" doesn't seem to work.  If anyone has a particular solution for that I would love to hear it.  Thanks!

  • abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @TValenzuela 

     

    Try to add a compose action step just above the step. Can you see the Dynamic content you looking for?

     

    Thanks

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard