Copy a file from SharePoint and paste it in another location in PowerAutomate

 

Copy a file from SharePoint and paste it in another location in PowerAutomate

Are you looking for a quick and easy way to copy a file from SharePoint, paste it to a new location, and rename it for easier identification? If so, you're in luck! In this guide, we'll show you how to copy a file from SharePoint and paste it to a new location while also renaming the pasted file using Power Automate. By following these simple steps, you can streamline your workflow and save time.

Step 1: Set up the flow (You can set the trigger as per your requirement, I used a very generic way to start the flow.)

  • Open Power Automate and create a new flow.
  • Choose the "Automated cloud flow" template and give your flow a name.
  • Select "When a file is created or modified (properties only)" as the trigger.
  • Connect your SharePoint account and select the site and library where the file you want to copy is located.
  • (Or you can set the trigger as per your requirement, I used a very generic way to start the flow.)

Step 2: Get the file content

  • Add a "Get file content" action to your flow.
  • (I have renamed the Action name to make you understand)
  • In the "Site Address" field, find and select the site where the file is stored.
  • In the “File Identifier” field, select the exact location of the master file.
  • Click "Save" to save the action.

No alt text provided for this image
The path of actual tempelate of excel

Step 3: Save the new file name in a variable

  • Add a "Compose" action to your flow.
  • In the "Inputs" section, enter the name you want to give to the pasted file.
  • (In my case, I need to create multiple files in the same folder so I set file name as the created time of the file to make it unique every time, the formula is “formatDateTime(utcNow(),'dd_MM_yyyy hh_mm_ss')”
  • Click "Save" to save the action.

No alt text provided for this image
Making the name for new file

Step 4: Create the new file

  • Add a "Create file" action to your flow.
  • In the "Folder path" field, enter the path to the new location where you want to paste the file.
  • In the "File name" field, select the output from the "Compose" action to use the new file name.
  • (You can also create new folder, as I’ve created to store my newly created file into a separate folder.)
  • In the "File content" field, select the output from the "Get file content" action.
  • Click "Save" to save the action.

No alt text provided for this image
Creting the new file with the new name

Step 5: Test the flow

  • Save and run your flow.
  • Go to your SharePoint site and check that the file has been copied to the new location with the new name.

Conclusion

Using Power Automate to copy a file from SharePoint and paste it to a new location while renaming the pasted file can save you time and reduce errors. By following these simple steps, you can streamline your workflow and ensure that your files are always named and organized in a consistent manner.

I hope this helps! Let me know if you have any questions or need further assistance.

Comments