Add Items in SharePoint List from CSV file

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.

  1. Add-PSSnapin Microsoft.SharePoint.PowerShell  
  2. $continents = Import-Csv "D:/Continents.csv"  
  3. # Web URL  
  4. $web = Get-SPWeb -Identity "http://moss13:1111/"   
  5. # SPList name  
  6. $list = $web.Lists["Continents"]   
  7. # Iterate for each list column  
  8. foreach ($row in $continents) {  
  9.    $item = $list.Items.Add();  
  10.    $item["Title"] = $row.Title;  
  11.    $item["Area"] = $row.Area;  
  12.    $item["Population"] = $row.Population;  
  13.    $item.Update();  
  14. }  
Check the List. Record is successfully added as below.
 
X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now