Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Get-OfficeCsv

Module
PSWriteOffice
Inputs
System.String[]
Outputs
OfficeIMO.CSV.CsvDocument

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: PathDelimiter
Get-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: PathCulture
Get-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: PathDetect
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]
-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: LiteralPathDelimiter
Get-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: LiteralPathCulture
Get-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: LiteralPathDetect
Get-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: TextDelimiter
Get-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: TextCulture
Get-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: TextDetect

Description

Returns an CsvDocument for inspection or further transformations.

Examples

Load a CSV file.

$csv = Get-OfficeCsv -Path .\data.csv

Loads 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.Header

Returns the header list so you can verify the expected column names.

Parameters

-AllowEmptyLines SwitchParameter optional
Allow empty lines in the input.
-CollectParseErrors SwitchParameter optional
Collect parse errors and write them as non-terminating errors after each input.
-ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy optional
Controls how rows with fewer or more fields than the header are handled.
Possible values: Strict, PadMissingFieldsAndIgnoreExtraFields
-CommentCharacter Char optional
Character that identifies comment rows.
-CompressionType CsvCompressionType optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect
Compression used when reading files. Auto infers from the file extension.
Possible values: Auto, GZip, Deflate, Brotli, ZLib
-Culture CultureInfo optional
Culture used for type conversions.
-DateTimeFormats String[] optional
Additional date/time formats used by typed conversions and validation.
-Delimiter Char optionalsets: PathDelimiter, LiteralPathDelimiter, TextDelimiter
Field delimiter character.
-DelimiterText String optionalsets: PathDelimiter, LiteralPathDelimiter, TextDelimiter
Field delimiter text for multi-character delimiters such as || or ::.
-DuplicateHeaderBehavior CsvDuplicateHeaderBehavior optional
Controls how duplicate header names are handled.
Possible values: Preserve, Rename, Throw
-Encoding Encoding optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect
Encoding used when reading the file.
-Header String[] optional
Explicit header names to use; when provided, the first CSV record is treated as data.
-InternStrings SwitchParameter optional
Reuse repeated string values through a per-read cache.
-MaxDecompressedBytes Int64 optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect
Maximum decompressed bytes to read from compressed CSV files.
-MaxFieldLength Int32 optional
Maximum length allowed for any parsed field.
-MaxParseErrors Int32 optional
Maximum number of collected parse errors before parsing fails.
-MaxQuotedFieldLength Int32 optional
Maximum length allowed for fields parsed from quoted records.
-NoHeader SwitchParameter optional
Treat the first record as data and generate default column names.
-NormalizeQuotes SwitchParameter optional
Normalize curly quote characters to straight quotes.
-NullValue String optional
Token that is materialized as null when loading rows.
-ParseErrorAction CsvParseErrorAction optional
How parse errors are handled.
Possible values: Throw, SkipRow
-Path String[] requiredposition: 0pipeline: True (ByValue, ByPropertyName)aliases: FilePath, InputPathsets: PathDelimiter, PathCulture, PathDetect
Path to one or more CSV files. Wildcards are supported.
-ProgressInterval Int32 optional
Report progress every N parsed records.
-QuoteParsingMode CsvQuoteParsingMode optional
Controls whether malformed quoted fields are parsed leniently or rejected.
Possible values: Lenient, Strict
-RecognizeW3CFieldsHeader Boolean optional
Recognize W3C Extended Log File Format #Fields: rows as headers.
-SkipCommentRows SwitchParameter optional
Skip comment rows throughout the file.
-SkipCommentRowsBeforeHeader Boolean optional
Skip comment rows starting with # while discovering the header.
-SkipRows Int32 optional
Number of parsed CSV records to skip before header discovery or data output.
-StaticColumns IDictionary optional
Static columns appended to every loaded row.
-TrimWhitespace Boolean optional
Trim whitespace around unquoted fields.
-UseCulture SwitchParameter requiredsets: PathCulture, LiteralPathCulture, TextCulture
Use the list separator from the selected or current culture as the delimiter.
-DelimiterCandidates Char[] optionalsets: PathDetect, LiteralPathDetect, TextDetect
Delimiter candidates to consider when detecting the delimiter.
-DetectDelimiter SwitchParameter requiredsets: PathDetect, LiteralPathDetect, TextDetect
Detect the delimiter from the first meaningful records.
-LiteralPath String[] requiredpipeline: True (ByPropertyName)aliases: LP, PSPathsets: LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect
Literal path to one or more CSV files.
-Text String requiredsets: TextDelimiter, TextCulture, TextDetect
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.