Skip to content

Add -NoHeader switch to Export-Csv and ConvertTo-Csv #17527

@iRon7

Description

@iRon7

Summary of the new feature / enhancement

The -Header parameter of the Import-Csv and ConvertFrom-Csv lets a user load data from headerless Csv files but there is actually no convenient way to convert or export the data back to a headerless Csv file or string.
The workaround is using the Select-Object cmdlet and skip the first line, e.g.:

Import-Csv .\input.csv -Header 1..9 | ... |ConvertTo-Csv |Select-Object -Skip 1 |Set-Content -Path .\Output.csv

See e.g.: Powershell export-csv with no headers?
and: Slowness to Remove 3,7 and 9 column from | separated txt file using PowerShell

Proposed technical implementation details (optional)

It would be nice to be able to simply do this:

Import-Csv .\input.csv -Header 1..9 | ... |Export-Csv .\Output.csv -NoHeader

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions