How to Move/Copy Files From OneDrive to SharePoint Using Power Automate?

Recently, I have been Working on Power Automate, where I got a requirement to move files from OneDrive to SharePoint online. The requirement is they want to move files at a particular time using Power Automate.

In this tutorial, I will show you how to move/copy files from OneDrive to SharePoint using Power Automate at a particular time. Also, we will see how to move only pdf files onedrive to SharePoint using Power Automate with different examples.

Copy Files from OneDrive to SharePoint using Power Automate

Let us see how to copy files from OneDrive to SharePoint using Power Automate.

Example-1: (Copy all files from OneDrive to SharePoint)

In this example, I will copy all the files that are presented in the HR Documents library in OneDrive by a flow.

power automate copy file from onedrive to sharepoint

In SharePoint Online, I have created a document library called HR Documents as shown below:

move files from onedrive to sharepoint power automate

Here we will create a button flow, and when a user clicks on it, the files will be moved from the OneDrive HR Documents library to the SharePoint HR Documents Library.

To achieve this, follow the below steps:

Step-1:

Create an instant cloud flow, Then select ‘Manually trigger a flow‘ to trigger the flow manually.

  • Then add +newstep and select the List file in Folders action from OneDrive for business action triggers.
  • In the Folder, select the Source Folder path by using Show Picker.
copy file from one drive to sharepoint using power automate

Step-2:

  • Then, we will add a Get file content action to get the content of a file. Here we will Pass the File ID from the dynamic content of the previous action i.e. list files in the folder.
  • It will automatically create an apply to each control to loop through each file presented in the HR Documents OneDrive Folder.
power automate copy files from onedrive to sharepoint
  • Add a new step and select the create file action for SharePoint. Provide the below details:
    • 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 (I have selected the HR Documents)
    • File Name – Pass the Dynamic content value Name for the file name
    • File Content – Add File content from the dynamic content value.
copy files from onedrive to sharepoint power automate

Step-3:

Save and run the flow by selecting the run flow option. Once flow ran successfully like below:

power automate copy file from onedrive to sharepoint

In the below screenshot, we can see it copies all the files from OneDrive to the SharePoint document library.

how to move files from onedrive to sharepoint power automate

This is how to Copy all Files from OneDrive to SharePoint using Power Automate.

Example-2: (Copy file from OneDrive to SharePoint)

In this example, I am going to copy files automatically from OneDrive to SharePoint using flow.

Whenever a new file is added to the OneDrive Employee Documents automatically the created file should be copied to the SharePoint document library.

The below screenshot displays the Employee Documents folder presented in OneDrive.

how to move files from onedrive to sharepoint using power automate

Similarly, I have a SharePoint document library called Employee Documents as shown below:

move files from onedrive to sharepoint in power automate flow

Here we will create an automated cloud flow so that whenever a new file is added to the OneDrive Employee Documents library it will automatically copy the created file to the SharePoint Employee Documents Library.

To achieve this, follow the below steps:

Step-1:

Create an Automated cloud flow, and choose the trigger When a file is created, In the Folder section, from the show picker select the Employee Documents as shown below:

move files from onedrive to sharepoint using power automate

Step-2:

Add a new step and choose the create file action for SharePoint. Provide the below details:

  • 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 (I have selected the Employee Documents)
  • File Name – Pass the Dynamic content value Name for the file name
  • File Content – Add File content from the dynamic content value.
move files from onedrive to sharepoint using power automate flow

Step-3:

Save and run the flow by selecting the run flow option. Here I have uploaded a file called (Grady.pdf) in the OneDrive Employee Documents highlighted below:

copy file from onedrive to sharepoint in power automate

Once the flow runs successfully like below:

copy file from onedrive to sharepoint using power automate flow

Automatically, the uploaded file is copied from the OneDrive document library to the SharePoint document library.

In the below screenshot, we can see it copies the Grady.pdf from OneDrive to the SharePoint document library.

copy file from onedrive to sharepoint in power automate flow

This is how to Copy Files from OneDrive to SharePoint using Power Automate.

Move Files From OneDrive to SharePoint at a Particular Time using Power Automate

Before starting the flow, you must have files in OneDrive. For this example, I created a files in OneDrive:

How do I copy data from OneDrive to SharePoint using Power Automate

Also, we require a SharePoint Online document library, so I created one:

How do I automatically upload OneDrive to SharePoint using Power Automate

I want the Power Automate flow to trigger at a specific time, so I used a scheduled cloud flow in Power Automate. 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 every weekday, so here, select 1 week.
  • On these days: Select the Weekdays, i.e., Monday to Friday.
Power Automate Move File from OneDrive to SharePoint

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

How do I copy files from Onedrive using Power Automate to SharePoint

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

Copy files from user OneDrive to SharePoint using Power Automate

4. Now, inside For each action, add the Create File action for SharePoint. Provide the below details:

  • 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 – Pass the Dynamic content value Name for the file name
  • File Content – Add File content from the dynamic content value.
power automate copy file from onedrive to sharepoint

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

copy files from onedrive to sharepoint power automate

Now, we need to run the flow.

Run the Flow to Move Files From OneDrive to SharePoint at a Particular Time

Now, it’s time to save the flow. Click on Test -> Select Manually -> click Test.

copy file from onedrive to sharepoint power automate

After the flow runs successfully, go to the SharePoint library, and you will see all the files successfully moved.

copy file from sharepoint to onedrive power automate

Also, you can see that the OneDrive files were deleted.

move files from onedrive to sharepoint power automate

Here, I am required to move, so I used the delete file action last. If your requirement is a copy, do not use that action.

Move Only PDF Files from Onedrive to SharePoint Using Power Automate

In this example, I will explain how to move a specific category of files, such as PDF, Excel, JPG, etc., using the same flow mentioned above.

Now, I have uploaded some files to OneDrive again. Check the screenshot below:

move file from onedrive to sharepoint power automate

Also, I deleted all files in the SharePoint library:

copy folder from onedrive to sharepoint power automate

Now edit the above flow and add a condition action after the List files in folder action.

power automate copy files from onedrive to sharepoint

Then open the Condition action Parameters and select the Name (from list files in folder action) value ends with .pdf.

power automate copy file from sharepoint to onedrive

After that, save the flow. Add the Get file content action in the true section and select the ID from the dynamic content.

move file from onedrive to sharepoint in power automate

Then, add a create file action for SharePoint. Provide the below details:

  • 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 – Pass the Dynamic content value Name for the file name
  • File Content – Add File content from the dynamic content value.
how to move files from onedrive to sharepoint in Power Automate

After that, add the delete file action for OneDrive. Then, select the ID from the dynamic content.

Power Automate Move files from OneDrive to SharePoint

Then, delete the ‘For each’ action shown below. Next, save the flow, and we can proceed to run it.

Run the Flow to Move Only PDF Files Onedrive to SharePoint

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 only the PDF file moved, not the other file.

Best Way to Move Files from OneDrive to SharePoint using Power Automate

Also, when you go to OneDrive, you can see only deleted PDF files and other files that are still present.

Move All Files from OneDrive for Business to SharePoint using Power Automate

In this example, I only show how to move PDF files from OneDrive to SharePoint using Power Automate. You can move any file from OneDrive to SharePoint. You only need to change the condition here, like I gave .pdf, but you can give it as per your requirement.

Conclusion

I hope you get an idea of copying files from OneDrive to SharePoint using Power Automate.

Here I have shown you two different examples of copying files from OneDrive to SharePoint. In the first example, I showed you how to copy all the files from OneDrive to SharePoint in Power Automate.

In the second example, I showed you how to copy files from OneDrive to SharePoint whenever a new file is added to the OneDrive documents library using Power Automate.

You may also like:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…