Add Files to Power Automate Variables

July 23rd 2021

You might need to add files to Power Automate Variables because the application can’t find the file independently. Or it might be that you want to add a specific file, not all files of the type you specify. Either way, this short (ish) video provides a detailed step-by-step guide on correctly adding files to Power Automate variables and later using the variables to pass the file to another action. The key points covered in the video guide are to:

  1. Ensure that you only store the base64 string element of file content in a string variable
  2. Wrap string variables containing base64 strings in the base64ToBinary() expression when passing to a ‘File Content’ property

Adding a File to Power Automate Variable

If the ‘File Content’ you are passing to a variable is structured as follows:

Then you must use the following expression to write the file into the variable: base64()

This ensures that only the base64 element of the structured file content is written into the variable.

If the ‘File Content’ you are passing to a variable is structured as follows, i.e. just a base64 string:

Then you must use the following expression to write the file to the variables: string()

This ensures that only the base64 is correctly preserved when written into the variable:

Sending a File Variable to an Action

Assuming the variable only contains a base64 string (as per this article), you must use the following expression when sending the variable to an actions ‘File Content’ property: base64ToBinary()

Finally

We hope you’ve found this guide useful, and as ever, please share any feedback or comments – all are welcome!

UPDATE: We’re excited to announce some significant updates to Flowr for Power Automate! As of October 2024, we’ve improved by updating action names and splitting Flowr’s central Power Automate connector into nine specialized connectors. These changes will make your workflow faster, smoother, and more efficient. The new action names are more precise and intuitive, saving you time, while the focused connectors enhance performance and flexibility. This update also helps future-proof the platform for even more powerful features. Check out our updated action names blog.

Author
Jay Goodison

Managing Director

You might also be interested in...