locked
All data insert only one SP list column When export CSV file using Power Shell cmd. RRS feed

  • General discussion

  • Hi Guy's,

    I'm try to export CSV. file data in sharepoint list using below Powershell cmd.

    It's working data export using this command but issues is All data insert in to only signal column (Attached Screenshot below).

    I'm use powershell cmd first time.

    Pl guide me.

    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Read the CSV file $CSVData = Import-CSV -path "C:\Users\administrator.xxx\Desktop\pindemo.csv" #If the CSV Doesn't has column Headers, you can create Named Headers $CSVData = Import-CSV -path "C:\Users\administrator.xxx\Desktop\pindemo.csv" -Header("VillageandLocalityName", "OfficeName", "PinCode", "SubDistName", "DistrictName","StateName") #Get the Web $web = Get-SPWeb -identity "http://sp1:1010/" #Get the Target List $list = $web.Lists["Test1Pin"] #Iterate through each Row in the CSV foreach ($row in $CSVData) { $item = $list.Items.Add(); $item["VillageandLocalityName"] = $row.VillageandLocalityName $item["OfficeName"] = $row.OfficeName $item["PinCode"] = $row.PinCode $item["SubDistName"] = $row.SubDistName $item["DistrictName"] = $row.DistrictName $item["StateName"] = $row.StateName $item.Update() }

    csv file 

    SP list 



    • Edited by Mohammad _Tahir Saturday, April 28, 2018 12:23 AM Add More screenshot
    Friday, April 27, 2018 11:47 PM

All replies