Skip to content

Document -NoHeader parameter in ConvertTo-Csv and Export-Csv Utility Cmdlets #9809

@ArmaanMcleod

Description

@ArmaanMcleod

Prerequisites

  • Existing Issue: Search the existing issues for this repository. If there is an issue that fits your needs do not file a new one. Subscribe, react, or comment on that issue instead.
  • Descriptive Title: Write the title for this issue as a short synopsis. If possible, provide context. For example, "Document new Get-Foo cmdlet" instead of "New cmdlet."

Summary

Added -NoHeader parameter to ConvertTo-Csv and Export-Csv cmdlets. This allows used to export CSV without headers much easier.

Details

Example ConvertTo-Csv Usage

PS C:\> $myObjects = @(
>     [PSCustomObject]@{
>         Name = 'John'
>         LastName = 'Smith'
>     }
>     [PSCustomObject]@{
>         Name = 'Freddy'
>         LastName = 'Kruger'
>     }
> )
PS C:\> $myObjects | ConvertTo-Csv -NoHeader | Out-File -FilePath 'output.csv'
PS C:\> cat 'output.csv'
"John","Smith"
"Freddy","Kruger"

Example Export-Csv Usage

PS C:\> $myObjects | Export-Csv -Path 'output.csv' -NoHeader
PS C:\> cat 'output.csv'
"John","Smith"
"Freddy","Kruger"

Can probably replace names or sample data if not appropriate 😄.

Articles

  • reference/7.3/Microsoft.PowerShell.Utility/ConvertTo-Csv.md
  • reference/7.3/Microsoft.PowerShell.Utility/Export-Csv.md

Related Source Pull Requests

Related Source Issues

Metadata

Metadata

Assignees

Labels

area-utilityArea - Microsoft.PowerShell.Utility moduleissue-doc-ideaIssue - request for new content

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions