Data transfer from OneDrive to SharePoint Site

Hi community, Is it possible to transfer a copy of OneDrive data to the Sharepoint site with PowerShell. If possible, can you please help me with the script.

You can use Gs Richcopy 360 or CloudFuze to directly transfer your data from Onedrive to SharePoint .Also you can use PowerShell Script that demonstrates how to transfer files from OneDrive to a SharePoint site using PowerShell, for example :

# Connect to OneDrive
$oneDriveUrl = "https://yourtenant-my.sharepoint.com/personal/yourusername_domain_com"
Connect-PnPOnline -Url $oneDriveUrl -UseWebLogin

# Connect to SharePoint site
$siteUrl = "https://yourtenant.sharepoint.com/sites/yoursite"
Connect-PnPOnline -Url $siteUrl -UseWebLogin

# Get all files from OneDrive
$files = Get-PnPListItem -List "Documents"

# Iterate through each file and upload to SharePoint
foreach ($file in $files) {
    $fileUrl = $file.FieldValues.FileRef
    $fileName = $file.FieldValues.FileLeafRef
    $fileStream = Get-PnPFile -Url $fileUrl -AsFile -Path "C:\Temp\$fileName"
    Add-PnPFile -Folder "Shared Documents" -Path $fileStream.FullName -FileName $fileName
}

# Disconnect from SharePoint site and OneDrive
Disconnect-PnPOnline

In this script, you first connect to your OneDrive by providing the URL. Then, you connect to the SharePoint site where you want to transfer the files. You can modify the URLs to match your specific OneDrive and SharePoint URLs.

Next, the script retrieves all the files from your OneDrive using the Get-PnPListItem cmdlet. It then iterates through each file, retrieves the file’s URL and name, and downloads it to a temporary location on your local machine.

Finally, the script uses the Add-PnPFile cmdlet to upload the file to the desired SharePoint site and folder. In this example, the files are uploaded to the “Shared Documents” library, but you can modify the folder name to match your target destination.

After the transfer is complete, the script disconnects from both the OneDrive and the SharePoint site.

And remember to install the SharePoint PnP PowerShell module before running the script.

Thread is old, closing.