Last week we explored SharePoint’s “Get File content” action and explained that we could get the file’s contents, like an Excel file. It’s quite a convenient way to get files, but it requires us to know the file and can point it out in the UI or provide the file’s ID. This is not convenient when we want to dynamically fetch the information, where we know the file’s path but don’t know its ID. To do that, we have the “Get file content using path” action we will explore today.
A few notes before we continue. There are analogous functions for OneDrive For Business , like the “Get File Content” action and the “Get File Content using Path” action, in case you’re interested in using OneDrive instead of SharePoint.
Where to find the “Get File Content using path” action?
You can find it in “Standard”.
If you don’t see “SharePoint,” click to expand.
Pick the “Get file content using path” action.
Here’s what it looks like.
There are also advanced options that you can pick by pressing the “Show advanced options”.
Now that we know how to find it let’s understand how to use it.
The usage is quite simple. There are two parameters:
- The SharePoint site where you have the file
- The file itself.
You must note that you can pick the file from the UI or provide its path. Here’s what it looks like:
When we run it, we get the following:
Notice that the data that we get looks “strange”. Since we’re getting an Excel file with an internal structure that is not readable by us, we’re getting its result in base64. If you don’t know what it is, don’t worry. In this case, consider it as “data” and provide it to the actions that require the information, and Power Automate will take care of the rest.
What about if we try to fetch the information from a text file like this?
The “Get file content using path” action will return the following.
Since we’re getting a text file, we won’t get it as a base64 file, but we’ll get its contents. This works the same way with CSV files, where the information is stored in clear text that you can “read”. Again, this is a great way to get information in bulk from a file and parse it in subsequential actions.
Finally, look at the advanced properties, like the “Infer Content Type”. This tells Power Automate to look at the extension and try to understand the content type. For an Excel file, it’s something like this:
Applications need this information to know what to do with the files and how to open them, for example.
It’s super rare that you’ll need to worry about this, but I wanted to include an explanation of what it is in case you’re curious or facing a situation where you need it. If you do, please let me know in the comments so I can include it here for others to benefit.
The “Get File content using path” action looks identical to the “Get file content” action. Here’s an example, but notice the subtle difference about the “File Identifier”.
We won’t use it in the “Get file content using path” action, so if you provide it, it will fail with the following error:
File not found clientRequestId: 50b44c69-778f-457d-b124-172b9d49a3e8 serviceRequestId: 50b44c69-778f-457d-b124-172b9d49a3e8
This is the same error message if the file doesn’t exist since it will try to find the path of the string you provide, regardless of what it is. So if you get this error, please look at the value inserted in the path and compare it with your SharePoint site’s file to see if it is there.
I could not find a hard limitation for the size of the files, but I’m sure there’s one. Don’t try to parse large files because you can hit Power Automate’s throughput limitations.
If you have found a limitation we should be aware of, please comment, and I’ll include it in the article for everyone to benefit.
Here are some things to keep in mind.
Name it correctly
The name is super important in this case because we can pick the file from the UI and get the file’s path from other actions in the Flow. The path can even be generated dynamically based on additional information, so it’s important to indicate how it’s calculated. Therefore, always build the name so others can understand your use without opening the action and checking the details.
Always add a comment.
Adding a comment will also help avoid mistakes. Indicate where the path comes from, for example, how you get it. It’s essential to enable faster debugging when something goes wrong.
Always deal with errors.
Have your Flow fail graciously and notify someone that something failed. It’s horrible to have failing Flows in Power Automate since they may go unlooked-for a while or generate even worse errors. I have a template that you can use to help you make your Flow resistant to issues. You can check all details here.
Back to the Power Automate Action Reference.