Import values from Excel to SharePoint list using PowerShell

Advertisement

In this article we can able to see how to import values from Excel to SharePoint List.

In our scenario we are having a list “VirtoSoftware ” having a TOP 5  Third party we parts(VitroSoftware is a  company  they design and builds innovate we parts for Microsoft SharePoint)  instead of entering manually using Power Shell we can do it easily.

This is the Excel and the list, Excel having the Information but list is having no items.
Now I am running the below PowerShell Script as show below.
Add-PSSnapin microsoft.sharepoint.powershell
$excelinfo = Import-Csv -Path "D:\VirtoSoftware.csv" -Header("Title")
 $web = Get-SPWeb http://virtosoftware.com/sites/topwebparts
$list = $web.Lists["virtosoftware"] write-host $list
foreach ($row in $excelinfo) {
    if($row.Title -ne "" -and $row.Title -ne $null)
    {
    $item = $list.Items.Add();
    $item["Title"] = $row.Title;
          $item.Update();
      }
}
 Once it’s completed finally we can see the OUTPUT


SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM
Advertisements
SHARE

Lakshmi Tulasi Jasti

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a comment