export csv

by bronyx85 at 2013-04-29 03:47:15

Hi, I have the following query which extracts list data to csv format.

Extracts the data fine, but it seems to include " " around the entitys.
Is there an extra comman I have to append on the end so that it does not include the "Doubel Quotes"???

Add-pssnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue

$MyWeb = Get-SPWeb http://myurl.local
$MyList = $MyWeb.Lists["My List"]
$exportlist = @()
$Mylist.Items | foreach {
$obj = New-Object PSObject -Property @{
"First Name" = $["FirstName"]
"Last Name" = $
["LastName"]
"Account Name" = $_["AccountName"]
}
$exportlist += $obj
$exportlist | Export-Csv -path ‘C:\Export.csv’ -NoTypeInformation
}


Thanks
by DonJ at 2013-04-29 14:17:14
You’re after the CODE button for formatting code, not the italics button <grin>.

As coded, Export-CSV applies double quotes around field names and data items. That’s valid CSV syntax - I’m not aware of a way to not do so using the native command.