I have one excel file and a SharePoint list(Employee master). I want to extract the user in csv file who is not in the SharePoint list(Employee Master).

If the employee not exists in SharePoint list we treat him as user terminated for internal tracking.

Please provide the PowerShell solution or if any other way.

1 Answer 1


Here is a script which work in my end. I used title column in csv file just for testing. You can replace the placeholder with the column name in your list. I only test with single text column. If you are using people and group column for user name. It may needs a bit more work and just let me know.

$csv=Import-Csv "<CSV file Path>"
$webURL="<Site URL>"
$web=Get-SPWeb $webURl
$list=$web.Lists | Where-Object { $_.Title -Eq $ListName }
foreach ($row in $csv) 
    $Items= $list.items | where {$_['<column Name>'] -eq $row.Title}
    If($Items.Length -eq 0)
        write-host $row.Title "does not exist in the SP list"


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.