Hello everybody,
I have a list in SharePoint with 10 columns and I always get excel files sent with the exact same 10 columns. Now I would like to transfer the Excel content to the SharePoint list. Is there a Powershell command that makes an import possible?
P.S. There is an export button at excel, but he keeps putting me on a new list in SharePoint. I would like to use the same list.
Best regards Christian
Solved! Go to Solution.
Hi @Christian866 ,
Have you specified the Title column within the Foreach function in your PowerShell window?
Please consider modify your Foreach function as below:
foreach ($Record in $CustomerData){ Add-PnPListItem -List "TestCSV" -Values @{ "Title"= $Record.'Personalnummer'; "Personalnummer"= $Record.'Personalnummer'; "Vorname"= $Record.'Vorname' }
}
please consider take a try with above PowerShell cmdlet, then check if the issue is solved.
Best regards,
Hi v-xida-msft,
Thank you for your answer.
If I add the "title" comes following (see picture). When I name the title as german name "Titel", he says he does not know the column.



I have the solution. There was a delimiter missing. The CSV had to be separated per column entry.
Here is the code:
$CustomerData = Import-CSV “D:\Test.csv” -Delimiter ";"
PS C:\WINDOWS\system32> foreach ($Record in $CustomerData){
Add-PnPListItem -List "TestCSV2" -Values @{
"Title"= $Record.'Personalnummer';
"Personalnummer"= $Record.'Personalnummer';
"Vorname"= $Record.'Vorname'
}
}
User | Count |
---|---|
195 | |
123 | |
86 | |
48 | |
40 |
User | Count |
---|---|
280 | |
165 | |
139 | |
80 | |
76 |