While working on Power Automate, I was required to move a file from OneDrive to the SharePoint library automatically. The flow must run daily at a specific time, retrieve the file from OneDrive, and move it to the SharePoint library.
However, the challenge is that the OneDrive file will be uploaded to the library using the same name. So, I need to overwrite the existing file in SharePoint without creating duplicates. And here, they want the SharePoint library to have one file every time.
In this tutorial, I will show you how to overwrite files using create file action in Power Automate.
Overwrite Files Using Create File Action in Power Automate
Before starting the flow, you must have a file in OneDrive. For this example, I created a files in OneDrive:

Also, we require a SharePoint Online document library, so I created one, and inside the document library, the same PDF is present: [At a specific time, the flow ran and moved the OneDrive file to library]

Let’s see how to create it:
1. Navigate to the Power Automate Home page, click + Create, and select the Scheduled Cloud Flow. Then provide the following information:
- Starting: Provide on which date you want to run your flow.
- at: Provide the time you want to run the flow, in my case, at 8:00 AM.
- Repeat every: We want to run the flow daily.

2. I need to select all files in OneDrive, so I used the List file in Folders action from OneDrive for business action, then selected the Source Folder path.

3. Next, I added the ‘Get file content‘ action from OneDrive. After that, select the ID from the dynamic content. This will automatically add Apply to each action.

4. Now, inside the ‘For each‘ action, add the ‘Create file’ action for SharePoint. Then, Provide the below Parameters:
- File Content: Add the ‘File content’ from the dynamic content.
- Site Address: Choose the SharePoint site from the dropdown.
- Folder Path: Select the folder from the Show Picker where you want to store the copied files.
- File Name: Use the dynamic content value ‘Name’ for the file name.

5. Now, again, select the create file action, then select Settings, and under the Netwoling, turn off Allow changing.

6. Finally, add a delete file action for OneDrive to delete the file from OneDrive. Then, select the ID from the dynamic content.

Run the Flow to Overwrite Files using the Create File Action
Test-1:
Now, it’s time to save the flow. Click on Test -> Select Manually -> click Test.

After the flow runs successfully, go to the SharePoint library, and you will see that the file has successfully overwritten the previous file.

As you know now, OneDrive has no files. Check the screenshot below:

Test – 2:
Again, Click on Test -> Select Manually -> click Test. Now we need to check what happens:

If you check now, there is one file in the SharePoint library, but as you can see from the flow run, no new file was created in the SharePoint library. This is my requirement, and this is how I can overwrite files using the make file action in Power Automate.
Also, you may like some more Power Automate tutorials:
- Move/Copy Files From OneDrive to SharePoint Using Power Automate
- Filter Excel Files Based On Date Using Power Automate
- Create an Excel File When an Item is Created in SharePoint List Using Power Automate
- Create a sharing link for a file or folder using Power Automate
- Create an Excel file from SharePoint list items using Power Automate

After working for more than 18 years in Microsoft technologies like SharePoint, Microsoft 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (12 times). I have also worked in companies like HP, TCS, KPIT, etc.