Fix Power Automate List Files in Folder Error with Excel Dynamic Path
Question details
The user needs to fix an issue where a Power Automate flow fails to retrieve files when using a folder path provided dynamically from an Excel table.
- Product
- Excel, Power Automate
- Device & OS
- not provided
- Scenario
- Using dynamic folder paths originating from an Excel file to list files in SharePoint or OneDrive via Power Automate.
- Observed behavior
- The 'List files in folder' action fails when using the dynamic content from Excel, even though the same action succeeds when the path is hard-coded.
Ensure you have edit access to both the target Excel file containing the folder paths and the Power Automate flow you are troubleshooting.
Format Excel Path Correctly and Verify with a Compose Action
Ensure the folder path stored in Excel exactly matches the SharePoint or OneDrive structure requirements, and use a Compose action in Power Automate to inspect the dynamic output.
Power Automate requires folder paths to strictly match the internal structure of SharePoint or OneDrive. Using local Windows paths (like C:\Users\) or incomplete display names will cause the 'List files in folder' action to fail.
Open your Excel file and modify the folder path column so it reflects the exact structure required by SharePoint or OneDrive (e.g., '/Shared Documents/TargetFolder'). Do not use local mapped paths or URL links.
In your Power Automate flow, add a 'Compose' action immediately before the 'List files in folder' action. Insert your Excel dynamic path content into the inputs field of the Compose action.
Run the flow and view the output of the Compose action. Compare this text character-by-character with a hard-coded path that you know works, paying close attention to the site, library, and slashes.
Once you have verified that the Excel output perfectly matches the required structure, place the dynamic content back into the 'Folder' field of the 'List files in folder' action and save your flow.
Manage Your Excel Data and Paths Easily with WPS Office
While troubleshooting Power Automate integrations, managing your backend data smoothly is critical. WPS Office offers a free, lightweight, and fully compatible alternative to Microsoft Office, making it simple to edit, clean, and organize dynamic content paths in spreadsheets.

Frequently Asked Questions
Why does a hard-coded path work in Power Automate but not dynamic Excel content?
A hard-coded path is statically verified by Power Automate. Dynamic content from Excel might contain hidden spaces, incorrect slashes (backslashes instead of forward slashes), or lack the required root directory (like '/Shared Documents/'), causing the flow to fail at runtime.
How do I correctly write a SharePoint path in an Excel table?
Always use forward slashes and include the correct document library name. For example, type '/Shared Documents/MyFolder' instead of 'C:\MyFolder' or pasting the full web URL.
Can I use formulas in Excel to format the path before sending it to Power Automate?
Yes, you can use Excel text formulas like SUBSTITUTE to replace backslashes with forward slashes, or CONCATENATE to prepend the necessary root library structure to the folder name, ensuring clean data is passed to Power Automate.




