Sitecore - select fields and write to an excel sheet by changing the field names in Powershell

25 Views Asked by At

I need to select items from Sitecore and write the output to an excel file, using PowerShell.

I am able to do that, but I need to change the field names while writing to the Excel file.

For instance, in Sitecore the item has fields: Name, ProviderPath
In Excel, they should be written as FileName, FilePath

Here is my code:

Import-Function -Name ConvertTo-Xlsx

$mediaItemContainer = Get-Item -Path "master:/sitecore/media library/Project/MyProject/MyImages" 

[byte[]]$items = $mediaItemContainer.Axes.GetDescendants() |
  Select-Object -Property Name, ProviderPath |
  ConvertTo-Xlsx

Out-Download -Name "images.xlsx" -InputObject $items
0

There are 0 best solutions below