I have created a continents list with column Title, Area and Population. For more detail check the Link.
All the continents record is added in a continents.csv as below
Open the PowerShell ISE as Administrator and run the below command.
- Add-PSSnapin Microsoft.SharePoint.PowerShell
- $continents = Import-Csv "D:/Continents.csv"
- # Web URL
- $web = Get-SPWeb -Identity "http://moss13:1111/"
- # SPList name
- $list = $web.Lists["Continents"]
- # Iterate for each list column
- foreach ($row in $continents) {
- $item = $list.Items.Add();
- $item["Title"] = $row.Title;
- $item["Area"] = $row.Area;
- $item["Population"] = $row.Population;
- $item.Update();
- }
Check the List. Record is successfully added as below.