API Reference
Cmdlet
ConvertFrom-OfficeCsv
Converts CSV text to PSCustomObjects or dictionaries.
Remarks
Reads CSV text from -Text or the pipeline and maps rows by header.
Examples
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:
TextDelimiterParameters
- AllowEmptyLines SwitchParameter
- Allow empty lines in the input.
- AsHashtable SwitchParameter
- Emit dictionaries instead of PSCustomObjects.
- ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy
- Controls how rows with fewer or more fields than the header are handled.
- Possible values:
Strict,PadMissingFieldsAndIgnoreExtraFields - CommentCharacter Char
- Character that identifies comment rows.
- Culture CultureInfo
- Culture used for type conversions.
- DateTimeFormats String[]
- Additional date/time formats used by typed conversions and validation.
- Delimiter Char
- Field delimiter character.
- DelimiterText String
- Field delimiter text for multi-character delimiters such as || or ::.
- DuplicateHeaderBehavior CsvDuplicateHeaderBehavior
- Controls how duplicate header names are handled.
- Possible values:
Preserve,Rename,Throw - Header String[]
- Explicit header names to use; when provided, the first CSV record is treated as data.
- Mode CsvLoadMode
- Load mode controlling materialization.
- Possible values:
InMemory,Stream - NoHeader SwitchParameter
- Treat the first record as data and generate default column names.
- NullValue String
- Token that is materialized as null when converting rows.
- QuoteParsingMode CsvQuoteParsingMode
- Controls whether malformed quoted fields are parsed leniently or rejected.
- Possible values:
Lenient,Strict - RecognizeW3CFieldsHeader Boolean
- Recognize W3C Extended Log File Format #Fields: rows as headers.
- SkipCommentRows SwitchParameter
- Skip comment rows throughout the input.
- SkipCommentRowsBeforeHeader Boolean
- Skip comment rows starting with # while discovering the header.
- SkipRows Int32
- Number of parsed CSV records to skip before header discovery or data output.
- StaticColumns IDictionary
- Static columns appended to every converted row.
- Text String
- CSV text to parse.
- TrimWhitespace Boolean
- 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:
TextCultureParameters
- AllowEmptyLines SwitchParameter
- Allow empty lines in the input.
- AsHashtable SwitchParameter
- Emit dictionaries instead of PSCustomObjects.
- ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy
- Controls how rows with fewer or more fields than the header are handled.
- Possible values:
Strict,PadMissingFieldsAndIgnoreExtraFields - CommentCharacter Char
- Character that identifies comment rows.
- Culture CultureInfo
- Culture used for type conversions.
- DateTimeFormats String[]
- Additional date/time formats used by typed conversions and validation.
- DuplicateHeaderBehavior CsvDuplicateHeaderBehavior
- Controls how duplicate header names are handled.
- Possible values:
Preserve,Rename,Throw - Header String[]
- Explicit header names to use; when provided, the first CSV record is treated as data.
- Mode CsvLoadMode
- Load mode controlling materialization.
- Possible values:
InMemory,Stream - NoHeader SwitchParameter
- Treat the first record as data and generate default column names.
- NullValue String
- Token that is materialized as null when converting rows.
- QuoteParsingMode CsvQuoteParsingMode
- Controls whether malformed quoted fields are parsed leniently or rejected.
- Possible values:
Lenient,Strict - RecognizeW3CFieldsHeader Boolean
- Recognize W3C Extended Log File Format #Fields: rows as headers.
- SkipCommentRows SwitchParameter
- Skip comment rows throughout the input.
- SkipCommentRowsBeforeHeader Boolean
- Skip comment rows starting with # while discovering the header.
- SkipRows Int32
- Number of parsed CSV records to skip before header discovery or data output.
- StaticColumns IDictionary
- Static columns appended to every converted row.
- Text String
- CSV text to parse.
- TrimWhitespace Boolean
- Trim whitespace around unquoted fields.
- UseCulture SwitchParameter
- 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:
TextDetectParameters
- AllowEmptyLines SwitchParameter
- Allow empty lines in the input.
- AsHashtable SwitchParameter
- Emit dictionaries instead of PSCustomObjects.
- ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy
- Controls how rows with fewer or more fields than the header are handled.
- Possible values:
Strict,PadMissingFieldsAndIgnoreExtraFields - CommentCharacter Char
- Character that identifies comment rows.
- Culture CultureInfo
- Culture used for type conversions.
- DateTimeFormats String[]
- Additional date/time formats used by typed conversions and validation.
- DelimiterCandidates Char[]
- Delimiter candidates to consider when detecting the delimiter.
- DetectDelimiter SwitchParameter
- Detect the delimiter from the first meaningful records.
- DuplicateHeaderBehavior CsvDuplicateHeaderBehavior
- Controls how duplicate header names are handled.
- Possible values:
Preserve,Rename,Throw - Header String[]
- Explicit header names to use; when provided, the first CSV record is treated as data.
- Mode CsvLoadMode
- Load mode controlling materialization.
- Possible values:
InMemory,Stream - NoHeader SwitchParameter
- Treat the first record as data and generate default column names.
- NullValue String
- Token that is materialized as null when converting rows.
- QuoteParsingMode CsvQuoteParsingMode
- Controls whether malformed quoted fields are parsed leniently or rejected.
- Possible values:
Lenient,Strict - RecognizeW3CFieldsHeader Boolean
- Recognize W3C Extended Log File Format #Fields: rows as headers.
- SkipCommentRows SwitchParameter
- Skip comment rows throughout the input.
- SkipCommentRowsBeforeHeader Boolean
- Skip comment rows starting with # while discovering the header.
- SkipRows Int32
- Number of parsed CSV records to skip before header discovery or data output.
- StaticColumns IDictionary
- Static columns appended to every converted row.
- Text String
- CSV text to parse.
- TrimWhitespace Boolean
- Trim whitespace around unquoted fields.
Outputs
System.Object