Import Csv and Create items and update values into fields using Sitecore powershell.
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)
1. No space Column Name in csv file
2. Name of the column in csv file should exact same in script row variables
CSV file Format
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.
So we will write a script like below Sitecore powershell powershell script.
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..
Issues Resolved (4)
Sitecore 9.3 (1)
International Business (1)
Innovations in Industries (3)
Supply Chain Management (1)
Industrial Engineering (12)
Sitecore 10 (3)
Cloud Computing (1)
Online Courses (1)
Online Resources (2)
Blazor WebAssembly (2)
Sitecore form (1)
MS Sql Server (1)
Angular 11 (2)
Automobile Engineering (5)
Sitecore powershell (1)
Microservice Architecture (1)
Sitecore Interview Questions (2)
Dotnet interview questions (1)
Sitecore useful links (1)