Hi @sns ,
Please check whether this library has unique permission. And check your permission if this library has unique permission.
Library > Library settings > Permissions for this document library
And you could try to use following PowerShell commands:
#Variables
$SiteURL = "https://xxx.sharepoint.com/sites/xxx"
$FilesPath = "D:\xxx"
$ServerRelativePath = "/Shared Documents"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
#Get All Files from a Local Folder
$Files = Get-ChildItem -Path $FilesPath -Force -Recurse
#Upload All files from the directory
ForEach ($File in $Files)
{
Write-host "Uploading $($File.Directory)\$($File.Name)"
#upload a file to sharepoint online using powershell - Upload File and Set Metadata
Add-PnPFile -Path "$($File.Directory)\$($File.Name)" -Folder $ServerRelativePath -Values @{"Title" = $($File.Name)}
}
For Reference: SharePoint Online: Upload Files to Document Library using PowerShell
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
If the answer is helpful, please click "Accept 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.