Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
############## PARAMETERS ####################
$WebUrl = "Enter the sitecollection url"
$Listname = "Enter the Listname"
#Convert CSV to UTF-8 with special characters
Get-Content E:\Tempfolder\testCSV.csv | Out-File
E:\Tempfolder\testCSV.csv -Encoding utf8
#Get the CSV file and connect to the SharePoint list
$DataSet = import-csv -Delimiter ";" -Path
E:\Tempfolder\testCSV.csv" -Encoding Unicode
######### Add to SPList ########
$spWeb = Get-SPWeb -identity $WebUrl # Get SPWeb
$list = $spWeb.Lists[$Listname] # Get SPList
for($i = 0; $i -le $DataSet.Count; $i++)
{
#Read current row
$row = $DataSet[$i]
$item = $list.Items.Add();
$item["SPColumn1"] = $row.'Column1'
$item["SPColumn2"] = $row.'Column2'
$item["SPColumn3"] = $row.'Column3'
$item["SPColumn_n"] = $row.'Column_n'
$item.Update()
}
Wednesday, 25 February 2015
Home
/
Import CSV
/
Powershell
/
SharePoint
/
SharePoint 2013
/
Powershell Import Data from csv to sharepoint 2013 list with special characters
Powershell Import Data from csv to sharepoint 2013 list with special characters

About Gowtham
I'm a software developer who enjoys building solutions, exploring new tech, and helping others grow through clean and simple content. This blog shares real-world coding tips, Power Platform how-tos, AI experiments, and lessons learned from hands-on experience.
SharePoint 2013
Subscribe to:
Post Comments (Atom)
Extremely useful information which you have shared here. This is a great way to enhance knowledge for us, and also helpful for us. Thankful to you for sharing an article like this.
ReplyDeleteMexico Export Data