
11,701 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Is there any Windows or SharePoint PowerShell command for copying local files to SharePoint?
Hi @spjkk,
You can use Add-PnPFile to copy files from local to SharePoint Online.
Here is an example:
#Config Variables
$SiteURL = "https://xxx.sharepoint.com"
$SourceFilePath ="C:\Documents\xxx.docx"
$DestinationPath = "Shared Documents" #Site Relative Path of the Library
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -interactive
#powershell pnp to upload file to sharepoint online
Add-PnPFile -Path $SourceFilePath -Folder $DestinationPath
Read more: SharePoint Online: Upload Files to Document Library using PowerShell.
If the answer is helpful, please click "Accept as Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.