Import Csv and Create items and update values into fields using Sitecore powershell.
Prem Murmu
on
9/29/2021 3:14:16 PM
Sitecore powershell is very useful module of any version of sitecore. We can do basic operation using Sitecore powershell like create items, update items name and fields values.
Today I will explain about creating bulk items or creating large of items and update the values on the fields in fews seconds, so this kind of quick operation can be only done by Sitecore powershell.
I will share a sitecore powershell script for it. It is going to do following job in it.
1. Import csv file (right format file)
2. Read all rows of csv file and get values to some powershell variables
3. There will be condtion flags(Skip or Update) to distinguish the type operation to be done.
Skip means: create item, remove or delete items.
Update: Update the values of existing items
4. Here, we create item and update values , so Skip flag will be in condition as well as in csv file first column.
5. Create item with the help of template item.
6. Manipulate the target item using created item and Update values on fields of the items.
May above steps not much clear but when you will dear to look at below powershell code, you will definitely get it. It is quite easy.
Lets I have to create 50 towns items and feed the values like name of town into Town Name field.
We will prepare a csv file format.(Download Csv Sample Here)
Note:
1. No space Column Name in csv file
2. Name of the column in csv file should exact same in script row variables
Ex:
Column name
CSV file:
Town_Name
in script:
$Town_Name= $row.Town_Name;
CSV file Format
Column Name
1. Update_Check: Skip conditional flag will in all rows.
2.Item_name: Items will be created with this names
3.Item_Path: Items will navigate to path and create item.
4.Town_Name: town name fields values.
Paste this scrip to Sitecor powershell ise and execute it and select the csv file.
It will start creating items and also show you logs in powershell console.
0 Comments on this post
Comments(0)||Login to Comments
- see more..
Categories
ALLAsp.Net (3)
Sitecore (11)
Issues Resolved (9)
Sitecore 9.3 (2)
International Business (1)
Innovations in Industries (3)
Supply Chain Management (1)
Industrial Engineering (14)
Sitecore 10 (4)
Sharepoint (1)
Azure (4)
Cloud Computing (1)
Online Courses (1)
Online Resources (2)
C# (1)
Blazor WebAssembly (2)
Sitecore form (1)
MS Sql Server (1)
Angular 11 (2)
Automobile Engineering (5)
Sitecore powershell (1)
Devops (2)
Microservice Architecture (1)
Sitecore Interview Questions (2)
Dotnet interview questions (1)
Sitecore useful links (1)
Privacy&Cookies (2)
Solr Search (2)
JavaScript (1)
sitecore xm cloud (3)