Skip to main content
All CollectionsMigratePowerShellTips and tricks
Import metadata with an Excel spreadsheet in PowerShell
Import metadata with an Excel spreadsheet in PowerShell
Updated this week

This article explains how you can use an Excel file exported from ShareGate Migrate to modify metadata during your migration.

For more information about the Excel file, see Export metadata and import and copy with Excel or CSV.

You can add custom metadata to your items by using an Excel spreadsheet in PowerShell with the following commands:

Note: You cannot use PowerShell to run Bulk edit content. To use an Excel spreadsheet to edit your items in place, see Export metadata and import and copy to run the operation directly in ShareGate Migrate.

Index

Create your Excel spreadsheet

To create the file, follow steps (1) to (8) from the Export metadata and import and copy article.

Note: You cannot export the Excel spreadsheet with PowerShell. You must export it directly in ShareGate Migrate.

Create your script

Use -ExcelFilePath on your copy line to run your migration with your Excel metadata spreadsheet.

Here is an example using Copy-Content:

Import-Module Sharegate$srcUsername = "sourceusername"$srcPassword = ConvertTo-SecureString 'sourcepassword' -AsPlainText -Force$dstUsername = "destinationusername"$dstPassword = ConvertTo-SecureString 'destinationpassword' -AsPlainText -Force$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite" -Username $srcUsername -Password $srcPassword$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite" -Username $dstUsername -Password $dstPassword$srcList = Get-List -Name "mysourcelist" -Site $srcSite$dstList = Get-List -Name "mydestinationlist" -Site $dstSiteCopy-Content -SourceList $srcList -DestinationList $dstList -ExcelFilePath "c:\Users\myUser\Desktop\myExcelFile.xslx"

Here are some guidelines for the script:

  • $srcUsername, $srcPassword, $dstUsername, and $dstPassword: Replace "sourceusername", 'sourcepassword', "destinationusername", and 'destinationpassword' with your Microsoft 365 credentials.

  • Connect-Site: If you need to change the authentication method, you will find how to do it in the Connect Site article.

  • $srcSite, and $dstSite: Adjust the URLs to match your source site and destination site.

  • $srcList, and $dstList: Replace "mysourcelist" and "mydestinationlist" with the names of the source list, and destination list.

  • -ExcelFilePath: Adjust the path to match the location of your Excel metadata file. This parameter can be used with Copy-Content, Import-Document, and Import-GoogleDriveDocument.

Did this answer your question?