Cmdlet
Get-OfficeCsv
Loads a CSV document from disk or parses CSV text.
Syntax
Get-OfficeCsv
[-AllowEmptyLines]
[-CollectParseErrors]
[-ColumnCountMismatchPolicy <Strict| PadMissingFieldsAndIgnoreExtraFields>]
[-CommentCharacter <Char>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormats <String[]>]
[-Delimiter <Char>]
[-DelimiterText <String>]
[-DuplicateHeaderBehavior <Preserve| Rename| Throw>]
[-Encoding <Encoding>]
[-Header <String[]>]
[-InternStrings]
[-MaxDecompressedBytes <Int64>]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw| SkipRow>]
[-Path] <String[]>
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient| Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
[-TrimWhitespace <Boolean>]
[<CommonParameters>]#Parameter set:
PathDelimiterGet-OfficeCsv
[-AllowEmptyLines]
[-CollectParseErrors]
[-ColumnCountMismatchPolicy <Strict| PadMissingFieldsAndIgnoreExtraFields>]
[-CommentCharacter <Char>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormats <String[]>]
[-DuplicateHeaderBehavior <Preserve| Rename| Throw>]
[-Encoding <Encoding>]
[-Header <String[]>]
[-InternStrings]
[-MaxDecompressedBytes <Int64>]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw| SkipRow>]
[-Path] <String[]>
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient| Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
[-TrimWhitespace <Boolean>]
-UseCulture
[<CommonParameters>]#Parameter set:
PathCultureGet-OfficeCsv
[-AllowEmptyLines]
[-CollectParseErrors]
[-ColumnCountMismatchPolicy <Strict| PadMissingFieldsAndIgnoreExtraFields>]
[-CommentCharacter <Char>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormats <String[]>]
[-DelimiterCandidates <Char[]>]
-DetectDelimiter
[-DuplicateHeaderBehavior <Preserve| Rename| Throw>]
[-Encoding <Encoding>]
[-Header <String[]>]
[-InternStrings]
[-MaxDecompressedBytes <Int64>]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw| SkipRow>]
[-Path] <String[]>
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient| Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
[-TrimWhitespace <Boolean>]
[<CommonParameters>]#Parameter set:
PathDetectGet-OfficeCsv
[-AllowEmptyLines]
[-CollectParseErrors]
[-ColumnCountMismatchPolicy <Strict| PadMissingFieldsAndIgnoreExtraFields>]
[-CommentCharacter <Char>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormats <String[]>]
[-Delimiter <Char>]
[-DelimiterText <String>]
[-DuplicateHeaderBehavior <Preserve| Rename| Throw>]
[-Encoding <Encoding>]
[-Header <String[]>]
[-InternStrings]
-LiteralPath <String[]>
[-MaxDecompressedBytes <Int64>]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw| SkipRow>]
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient| Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
[-TrimWhitespace <Boolean>]
[<CommonParameters>]#Parameter set:
LiteralPathDelimiterGet-OfficeCsv
[-AllowEmptyLines]
[-CollectParseErrors]
[-ColumnCountMismatchPolicy <Strict| PadMissingFieldsAndIgnoreExtraFields>]
[-CommentCharacter <Char>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormats <String[]>]
[-DuplicateHeaderBehavior <Preserve| Rename| Throw>]
[-Encoding <Encoding>]
[-Header <String[]>]
[-InternStrings]
-LiteralPath <String[]>
[-MaxDecompressedBytes <Int64>]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw| SkipRow>]
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient| Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
[-TrimWhitespace <Boolean>]
-UseCulture
[<CommonParameters>]#Parameter set:
LiteralPathCultureGet-OfficeCsv
[-AllowEmptyLines]
[-CollectParseErrors]
[-ColumnCountMismatchPolicy <Strict| PadMissingFieldsAndIgnoreExtraFields>]
[-CommentCharacter <Char>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormats <String[]>]
[-DelimiterCandidates <Char[]>]
-DetectDelimiter
[-DuplicateHeaderBehavior <Preserve| Rename| Throw>]
[-Encoding <Encoding>]
[-Header <String[]>]
[-InternStrings]
-LiteralPath <String[]>
[-MaxDecompressedBytes <Int64>]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw| SkipRow>]
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient| Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
[-TrimWhitespace <Boolean>]
[<CommonParameters>]#Parameter set:
LiteralPathDetectGet-OfficeCsv
[-AllowEmptyLines]
[-CollectParseErrors]
[-ColumnCountMismatchPolicy <Strict| PadMissingFieldsAndIgnoreExtraFields>]
[-CommentCharacter <Char>]
[-Culture <CultureInfo>]
[-DateTimeFormats <String[]>]
[-Delimiter <Char>]
[-DelimiterText <String>]
[-DuplicateHeaderBehavior <Preserve| Rename| Throw>]
[-Header <String[]>]
[-InternStrings]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw| SkipRow>]
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient| Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
-Text <String>
[-TrimWhitespace <Boolean>]
[<CommonParameters>]#Parameter set:
TextDelimiterGet-OfficeCsv
[-AllowEmptyLines]
[-CollectParseErrors]
[-ColumnCountMismatchPolicy <Strict| PadMissingFieldsAndIgnoreExtraFields>]
[-CommentCharacter <Char>]
[-Culture <CultureInfo>]
[-DateTimeFormats <String[]>]
[-DuplicateHeaderBehavior <Preserve| Rename| Throw>]
[-Header <String[]>]
[-InternStrings]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw| SkipRow>]
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient| Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
-Text <String>
[-TrimWhitespace <Boolean>]
-UseCulture
[<CommonParameters>]#Parameter set:
TextCultureGet-OfficeCsv
[-AllowEmptyLines]
[-CollectParseErrors]
[-ColumnCountMismatchPolicy <Strict| PadMissingFieldsAndIgnoreExtraFields>]
[-CommentCharacter <Char>]
[-Culture <CultureInfo>]
[-DateTimeFormats <String[]>]
[-DelimiterCandidates <Char[]>]
-DetectDelimiter
[-DuplicateHeaderBehavior <Preserve| Rename| Throw>]
[-Header <String[]>]
[-InternStrings]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw| SkipRow>]
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient| Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
-Text <String>
[-TrimWhitespace <Boolean>]
[<CommonParameters>]#Parameter set:
TextDetectDescription
Returns an CsvDocument for inspection or further transformations.
Examples
Load a CSV file.
$csv = Get-OfficeCsv -Path .\data.csvLoads the CSV file into an OfficeIMO CsvDocument.
Parse CSV text with a custom delimiter.
$csv = Get-OfficeCsv -Text \"Name;Total`nAlpha;10\" -Delimiter ';'Parses a semicolon-delimited CSV string into a document.
Inspect headers as a schema hint.
$csv = Get-OfficeCsv -Path .\data.csv; $csv.HeaderReturns the header list so you can verify the expected column names.
Parameters
- -AllowEmptyLines SwitchParameter
- Allow empty lines in the input.
- -CollectParseErrors SwitchParameter
- Collect parse errors and write them as non-terminating errors after each input.
- -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.
- -CompressionType CsvCompressionType
- Compression used when reading files. Auto infers from the file extension.
- Possible values:
Auto,GZip,Deflate,Brotli,ZLib - -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 - -Encoding Encoding
- Encoding used when reading the file.
- -Header String[]
- Explicit header names to use; when provided, the first CSV record is treated as data.
- -InternStrings SwitchParameter
- Reuse repeated string values through a per-read cache.
- -MaxDecompressedBytes Int64
- Maximum decompressed bytes to read from compressed CSV files.
- -MaxFieldLength Int32
- Maximum length allowed for any parsed field.
- -MaxParseErrors Int32
- Maximum number of collected parse errors before parsing fails.
- -MaxQuotedFieldLength Int32
- Maximum length allowed for fields parsed from quoted records.
- -NoHeader SwitchParameter
- Treat the first record as data and generate default column names.
- -NormalizeQuotes SwitchParameter
- Normalize curly quote characters to straight quotes.
- -NullValue String
- Token that is materialized as null when loading rows.
- -ParseErrorAction CsvParseErrorAction
- How parse errors are handled.
- Possible values:
Throw,SkipRow - -Path String[]
- Path to one or more CSV files. Wildcards are supported.
- -ProgressInterval Int32
- Report progress every N parsed records.
- -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 file.
- -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 loaded row.
- -TrimWhitespace Boolean
- Trim whitespace around unquoted fields.
- -UseCulture SwitchParameter
- Use the list separator from the selected or current culture as the delimiter.
- -DelimiterCandidates Char[]
- Delimiter candidates to consider when detecting the delimiter.
- -DetectDelimiter SwitchParameter
- Detect the delimiter from the first meaningful records.
- -LiteralPath String[]
- Literal path to one or more CSV files.
- -Text String
- CSV text to parse.
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.