Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Import-Csv Should apply PSTypeNames uppon import when Type Information is present in the CSV #5134

Copy link
Copy link
@markekraus

Description

@markekraus
Issue body actions

The seemingly only useful way to use the Type Information currently added by default during Export-Csv would be to reapply the PSTypeNames to the PSCustomObjects. Currently, These Type names are currently prepended with CSV:. This means that exporting a simple PSObject to CSV and then re-importing would require 2 format definitions or add/set the PSTypeNames for the imported objects.

Steps to reproduce

[PSCustomObject]@{
    PSTypeName = 'My.Custom.Object'
    Column1 = 'values1'
} | Export-Csv C:\temp\csv.csv
$import = Import-Csv C:\temp\csv.csv
$import.PSObject.TypeNames

Expected behavior

My.Custom.Object

Actual behavior

CSV:My.Custom.Object

Environment data

Name                           Value
----                           -----
PSVersion                      6.0.0-beta.8
PSEdition                      Core
GitCommitId                    v6.0.0-beta.8
OS                             Microsoft Windows 10.0.15063
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking-Changebreaking change that may affect usersbreaking change that may affect usersCommittee-ReviewedPS-Committee has reviewed this and made a decisionPS-Committee has reviewed this and made a decisionIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.