Posts

Showing posts from July, 2023

Sitecore Powershell Extensions - Upload data to Sitecore from a csv file

Image
As Sitecore developers or content managers working with large amounts of data we often need a way to update items in bulk using CSV files. In this blog post, I'll walk you through how to use a script to update fields in Sitecore items based on a corresponding CSV file entry. In this specific example, we will use Price Codes already existing in Sitecore items and update the corresponding Price field. However, this script can be extended to support different scenarios. The final version of the script is the following: $fieldRequiredValidator = { if([string]::IsNullOrEmpty($variable.Value)){ $variable.Error = "Please provide a value." } } $dialogProps = @{ Parameters = @( @{ Name = "itemPath"; Title="Root"; Tooltip="The root of the items to be updated"; Source="Datasource=/sitecore/content/"; editor="droptree";}, @{ Name = "csvPath"; Value="&