Murali Kris

Murali Kris

  • 1.5k
  • 254
  • 48.5k

Need to export CSV file with out quotes

Apr 2 2024 12:30 PM

Hi Team,

I am trying to get Group members from SharePoint, I need to export to csv, I don`t understand why double quotes is sourended each value. Please see the code below.

foreach($line in $csv) { 
$exportData = Get-PnPGroupMembers -Identity $line.Url | Select-Object -Property Title 
$exportusers = foreach($user in $exportData){ 
[PSCustomObject]@{ "Group" =$line.Url "users" = $user.Title} 
} 
}$exportusers | Export-Csv -Path $OutputFile -NoTypeInformation

here is the output 

"PatientGO Studies (ShP Group)" "Allen, Sarah"

But expecting like 

PatientGO Studies (ShP Group) Allen, Sarah

also i have update PS object like below.

$GroupData.Add($(New-Object PSObject -Property ([ordered]@{"GroupName" = $line.Url;"User" = $user.Title })))

 

output in PS is fine, but in put file still it shows with double quotes.

help please ?


Answers (1)