How to Import CSV contents into SharePoint 2013 using PowerShell?

Hi SharePointers,

In real world scenario, you get bulk of data and if it is .csv format, you can easily upload to SharePoint 2013 environment using the below powershell. Below are the code sample to achieve the bulk upload in to a SharePoint List in SharePoint 2013.


(Get-PSSnapin | Where {$_.Name -eq “Microsoft.SharePoint.PowerShell”}) -eq $null) {
Add-PSSnapin Microsoft.SharePoint.PowerShell

$count = 0
$web = Get-SPWeb http://mysite/dev

$list = $web.lists[“EmployeeInformation”]

foreach($record in Import-CSV C:|EmployeeInfo.csv)
$newrecord = $list.Items.Add()
$newrecord[“Name”] = $record.Name
$newrecord[“Address”] = $record.Address
$newrecord[“Email”] = $record.Email
$newrecord[“Contact”] = $record.Contact
$count ++
“No of Record Uploaded ” + $count.ToString()

Happy SharePointing Folks 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *