Copy SharePoint List Column Values from One to Another using PowerShell

Requirement: Copy Column Values from One to Another in SharePoint

How to copy column value to another column in SharePoint?

In some situations, we may have to copy SharePoint list column values from one column to another. Say, for E.g.

  • OOTB column doesn’t provide a way to enter more than 255 characters in Multiple Lines of Text field. As user already entered values in it and wants to make it allow more than 255 chars.
  • When a SharePoint field’s internal name needs to be changed.
  • There is requirement to add a new column, whose values are partially based on an existing column

While the Data Sheet view is one solution, Its not available for all lists. And even in datasheet view, some columns like people picker values can’t be copy/pasted. So, the solution is: PowerShell

Copy Column Values from one to another in SharePoint using PowerShell

PowerShell to Copy Column Values from one to another in SharePoint

Here is the PowerShell script to copy SharePoint list / library field data from one column to another column:

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue

#Parameters
$SiteURL = "https://sharepoint.crescent.com/"
$listName = "Pictures"

$web = Get-SPweb $SiteURL
 
#Use the Display Names
$CopyFromColumnName = "Description" #column copy source
$CopyToColumnName = "Desc"  #destination column

#Get the List
$list = $web.lists[$ListName]

#Get all Items  
$Items = $list.Items

ForEach ($Item in $items)
{
   #copy data from one column to another
   $item[$copyToColumnName] = $item[$copyFromColumnName]

   #Do a system update to avoid Version and to Keep same metadata
   $item.SystemUpdate($false)
}

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

2 thoughts on “Copy SharePoint List Column Values from One to Another using PowerShell

Leave a Reply

Your email address will not be published. Required fields are marked *