API Reference

Cmdlet

ConvertFrom-OfficeCsv

Namespace PSWriteOffice
Inputs
System.String
Outputs
System.Object

Converts CSV text to PSCustomObjects or dictionaries.

Remarks

Reads CSV text from -Text or the pipeline and maps rows by header.

Examples

Authored help example

Convert CSV text into rows.

PS>


$rows = ConvertFrom-OfficeCsv -Text "Name,Value`nAlpha,1"
        

Parses CSV text and emits row objects without writing a temporary file.

Convert piped CSV lines.

PS>


"Name,Value", "Alpha,1" | ConvertFrom-OfficeCsv
        

Treats piped lines as one CSV stream.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

ConvertFrom-OfficeCsv [-AllowEmptyLines] [-AsHashtable] [-ColumnCountMismatchPolicy <Strict|PadMissingFieldsAndIgnoreExtraFields>] [-CommentCharacter <Char>] [-Culture <CultureInfo>] [-DateTimeFormats <String[]>] [-Delimiter <Char>] [-DelimiterText <String>] [-DuplicateHeaderBehavior <Preserve|Rename|Throw>] [-Header <String[]>] [-Mode <InMemory|Stream>] [-NoHeader] [-NullValue <String>] [-QuoteParsingMode <Lenient|Strict>] [-RecognizeW3CFieldsHeader <Boolean>] [-SkipCommentRows] [-SkipCommentRowsBeforeHeader <Boolean>] [-SkipRows <Int32>] [-StaticColumns <IDictionary>] -Text <String> [-TrimWhitespace <Boolean>] [<CommonParameters>]
#
Parameter set: TextDelimiter

Parameters

AllowEmptyLines SwitchParameter optionalposition: namedpipeline: False
Allow empty lines in the input.
AsHashtable SwitchParameter optionalposition: namedpipeline: False
Emit dictionaries instead of PSCustomObjects.
ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy optionalposition: namedpipeline: Falsevalues: 2
Controls how rows with fewer or more fields than the header are handled.
Possible values: Strict, PadMissingFieldsAndIgnoreExtraFields
CommentCharacter Char optionalposition: namedpipeline: False
Character that identifies comment rows.
Culture CultureInfo optionalposition: namedpipeline: False
Culture used for type conversions.
DateTimeFormats String[] optionalposition: namedpipeline: False
Additional date/time formats used by typed conversions and validation.
Delimiter Char optionalposition: namedpipeline: False
Field delimiter character.
DelimiterText String optionalposition: namedpipeline: False
Field delimiter text for multi-character delimiters such as || or ::.
DuplicateHeaderBehavior CsvDuplicateHeaderBehavior optionalposition: namedpipeline: Falsevalues: 3
Controls how duplicate header names are handled.
Possible values: Preserve, Rename, Throw
Header String[] optionalposition: namedpipeline: False
Explicit header names to use; when provided, the first CSV record is treated as data.
Mode CsvLoadMode optionalposition: namedpipeline: Falsevalues: 2
Load mode controlling materialization.
Possible values: InMemory, Stream
NoHeader SwitchParameter optionalposition: namedpipeline: False
Treat the first record as data and generate default column names.
NullValue String optionalposition: namedpipeline: False
Token that is materialized as null when converting rows.
QuoteParsingMode CsvQuoteParsingMode optionalposition: namedpipeline: Falsevalues: 2
Controls whether malformed quoted fields are parsed leniently or rejected.
Possible values: Lenient, Strict
RecognizeW3CFieldsHeader Boolean optionalposition: namedpipeline: False
Recognize W3C Extended Log File Format #Fields: rows as headers.
SkipCommentRows SwitchParameter optionalposition: namedpipeline: False
Skip comment rows throughout the input.
SkipCommentRowsBeforeHeader Boolean optionalposition: namedpipeline: False
Skip comment rows starting with # while discovering the header.
SkipRows Int32 optionalposition: namedpipeline: False
Number of parsed CSV records to skip before header discovery or data output.
StaticColumns IDictionary optionalposition: namedpipeline: False
Static columns appended to every converted row.
Text String requiredposition: 0pipeline: True (ByValue)
CSV text to parse.
TrimWhitespace Boolean optionalposition: namedpipeline: False
Trim whitespace around unquoted fields.

Outputs

System.Object

ConvertFrom-OfficeCsv [-AllowEmptyLines] [-AsHashtable] [-ColumnCountMismatchPolicy <Strict|PadMissingFieldsAndIgnoreExtraFields>] [-CommentCharacter <Char>] [-Culture <CultureInfo>] [-DateTimeFormats <String[]>] [-DuplicateHeaderBehavior <Preserve|Rename|Throw>] [-Header <String[]>] [-Mode <InMemory|Stream>] [-NoHeader] [-NullValue <String>] [-QuoteParsingMode <Lenient|Strict>] [-RecognizeW3CFieldsHeader <Boolean>] [-SkipCommentRows] [-SkipCommentRowsBeforeHeader <Boolean>] [-SkipRows <Int32>] [-StaticColumns <IDictionary>] -Text <String> [-TrimWhitespace <Boolean>] -UseCulture [<CommonParameters>]
#
Parameter set: TextCulture

Parameters

AllowEmptyLines SwitchParameter optionalposition: namedpipeline: False
Allow empty lines in the input.
AsHashtable SwitchParameter optionalposition: namedpipeline: False
Emit dictionaries instead of PSCustomObjects.
ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy optionalposition: namedpipeline: Falsevalues: 2
Controls how rows with fewer or more fields than the header are handled.
Possible values: Strict, PadMissingFieldsAndIgnoreExtraFields
CommentCharacter Char optionalposition: namedpipeline: False
Character that identifies comment rows.
Culture CultureInfo optionalposition: namedpipeline: False
Culture used for type conversions.
DateTimeFormats String[] optionalposition: namedpipeline: False
Additional date/time formats used by typed conversions and validation.
DuplicateHeaderBehavior CsvDuplicateHeaderBehavior optionalposition: namedpipeline: Falsevalues: 3
Controls how duplicate header names are handled.
Possible values: Preserve, Rename, Throw
Header String[] optionalposition: namedpipeline: False
Explicit header names to use; when provided, the first CSV record is treated as data.
Mode CsvLoadMode optionalposition: namedpipeline: Falsevalues: 2
Load mode controlling materialization.
Possible values: InMemory, Stream
NoHeader SwitchParameter optionalposition: namedpipeline: False
Treat the first record as data and generate default column names.
NullValue String optionalposition: namedpipeline: False
Token that is materialized as null when converting rows.
QuoteParsingMode CsvQuoteParsingMode optionalposition: namedpipeline: Falsevalues: 2
Controls whether malformed quoted fields are parsed leniently or rejected.
Possible values: Lenient, Strict
RecognizeW3CFieldsHeader Boolean optionalposition: namedpipeline: False
Recognize W3C Extended Log File Format #Fields: rows as headers.
SkipCommentRows SwitchParameter optionalposition: namedpipeline: False
Skip comment rows throughout the input.
SkipCommentRowsBeforeHeader Boolean optionalposition: namedpipeline: False
Skip comment rows starting with # while discovering the header.
SkipRows Int32 optionalposition: namedpipeline: False
Number of parsed CSV records to skip before header discovery or data output.
StaticColumns IDictionary optionalposition: namedpipeline: False
Static columns appended to every converted row.
Text String requiredposition: 0pipeline: True (ByValue)
CSV text to parse.
TrimWhitespace Boolean optionalposition: namedpipeline: False
Trim whitespace around unquoted fields.
UseCulture SwitchParameter requiredposition: namedpipeline: False
Use the list separator from the selected or current culture as the delimiter.

Outputs

System.Object

ConvertFrom-OfficeCsv [-AllowEmptyLines] [-AsHashtable] [-ColumnCountMismatchPolicy <Strict|PadMissingFieldsAndIgnoreExtraFields>] [-CommentCharacter <Char>] [-Culture <CultureInfo>] [-DateTimeFormats <String[]>] [-DelimiterCandidates <Char[]>] -DetectDelimiter [-DuplicateHeaderBehavior <Preserve|Rename|Throw>] [-Header <String[]>] [-Mode <InMemory|Stream>] [-NoHeader] [-NullValue <String>] [-QuoteParsingMode <Lenient|Strict>] [-RecognizeW3CFieldsHeader <Boolean>] [-SkipCommentRows] [-SkipCommentRowsBeforeHeader <Boolean>] [-SkipRows <Int32>] [-StaticColumns <IDictionary>] -Text <String> [-TrimWhitespace <Boolean>] [<CommonParameters>]
#
Parameter set: TextDetect

Parameters

AllowEmptyLines SwitchParameter optionalposition: namedpipeline: False
Allow empty lines in the input.
AsHashtable SwitchParameter optionalposition: namedpipeline: False
Emit dictionaries instead of PSCustomObjects.
ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy optionalposition: namedpipeline: Falsevalues: 2
Controls how rows with fewer or more fields than the header are handled.
Possible values: Strict, PadMissingFieldsAndIgnoreExtraFields
CommentCharacter Char optionalposition: namedpipeline: False
Character that identifies comment rows.
Culture CultureInfo optionalposition: namedpipeline: False
Culture used for type conversions.
DateTimeFormats String[] optionalposition: namedpipeline: False
Additional date/time formats used by typed conversions and validation.
DelimiterCandidates Char[] optionalposition: namedpipeline: False
Delimiter candidates to consider when detecting the delimiter.
DetectDelimiter SwitchParameter requiredposition: namedpipeline: False
Detect the delimiter from the first meaningful records.
DuplicateHeaderBehavior CsvDuplicateHeaderBehavior optionalposition: namedpipeline: Falsevalues: 3
Controls how duplicate header names are handled.
Possible values: Preserve, Rename, Throw
Header String[] optionalposition: namedpipeline: False
Explicit header names to use; when provided, the first CSV record is treated as data.
Mode CsvLoadMode optionalposition: namedpipeline: Falsevalues: 2
Load mode controlling materialization.
Possible values: InMemory, Stream
NoHeader SwitchParameter optionalposition: namedpipeline: False
Treat the first record as data and generate default column names.
NullValue String optionalposition: namedpipeline: False
Token that is materialized as null when converting rows.
QuoteParsingMode CsvQuoteParsingMode optionalposition: namedpipeline: Falsevalues: 2
Controls whether malformed quoted fields are parsed leniently or rejected.
Possible values: Lenient, Strict
RecognizeW3CFieldsHeader Boolean optionalposition: namedpipeline: False
Recognize W3C Extended Log File Format #Fields: rows as headers.
SkipCommentRows SwitchParameter optionalposition: namedpipeline: False
Skip comment rows throughout the input.
SkipCommentRowsBeforeHeader Boolean optionalposition: namedpipeline: False
Skip comment rows starting with # while discovering the header.
SkipRows Int32 optionalposition: namedpipeline: False
Number of parsed CSV records to skip before header discovery or data output.
StaticColumns IDictionary optionalposition: namedpipeline: False
Static columns appended to every converted row.
Text String requiredposition: 0pipeline: True (ByValue)
CSV text to parse.
TrimWhitespace Boolean optionalposition: namedpipeline: False
Trim whitespace around unquoted fields.

Outputs

System.Object