Reputation: 9
I'm working on creating a Power Automate solution that generates a CSV file in a SharePoint folder using data from a Power BI dataset. This currently works for a simple file creation process, but I need to add steps to check if the file exists in SharePoint. If the file exists, the process should overwrite it; otherwise, it should create a new file.
I tried adding a "Get file properties only" step at the end of the process to retrieve a list of filenames, followed by a conditional step to check if a specific filename exists. If it does, the process should update the file; if not, it should create a new one. However, the conditional step is being skipped. I believe this happens because the conditional step loops through the list of returned files, but if no files exist in the folder, it stops.
I can circumvent this issue by creating a dummy file and allowing the update step to constantly update it. However, I want the process to be more robust in case the file is accidentally deleted or moved from the folder. Could someone please provide guidance on how to achieve this?
Upvotes: 0
Views: 52
Reputation: 446
Generate the file in a separate folder (that should be empty) and move it to the main folder right after generation (which will make the other folder empty again for next use).
When you move, you have the option to overwrite the file if it already exists.
Upvotes: 0