Hi @Pascoe, Todd
You can refer to following script to update link in csv
#Connect to SharePoint Online
Connect-PnPOnline -Url $SiteURL -Interactive
#Import and read the rows one by one
Import-CSV "C:\xie\SPurl.csv" | ForEach-Object {
#Current row object
$CSVRecord = $_
#Read column values in the current row
$SiteURL = $CSVRecord.'SiteURL'
$ListName = $CSVRecord.'ListName'
$ColumnName = $CSVRecord.'ColumnName'
$OldLink = $CSVRecord.'OldLink'
$NewLink = $CSVRecord.'NewLink'
#Get All List Items
$ListItems = Get-PnPListItem -List $ListName -PageSize 2000
#Iterate through all items in the list
ForEach ($Item in $ListItems)
{
$Flag = $false
$URL = $Item.FieldValues[$ColumnName].URL.ToLower()
#Check if the URL has the old text
If($URL.contains($OldString))
{
$URL = $URL -Replace $OldString,$NewString
$Flag = $True
}
#check the description of the Hyperlink
$Description = $Item.FieldValues[$ColumnName].Description.ToLower()
If($Description.contains($OldString))
{
$Description = $Description -Replace $OldString,$NewString
$Flag = $True
}
#update the Hyperlink field if URL or Description has the old string
If($Flag -eq $True)
{
#Frame the URL field value
$Hyperlink = New-Object Microsoft.SharePoint.Client.FieldUrlValue
$Hyperlink.Url= $URL
$Hyperlink.Description= $Description
#Update Hyperlink field value
Set-PnPListItem -List $ListName -Identity $Item.Id -Values @{$ColumnName = [Microsoft.SharePoint.Client.FieldUrlValue]$Hyperlink} | Out-Null
Write-host -f Green "List Item $($Item.ID) Updated!"
}
}
}
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.