API Reference

Cmdlet

Import-OfficeCsv

Namespace PSWriteOffice
Inputs
OfficeIMO.CSV.CsvDocument System.String[]
Outputs
System.Object

Imports CSV rows as PSCustomObjects, dictionaries, or a DataTable.

Remarks

Uses the CSV header to map fields to property names.

Examples

Authored help example

Read rows as PSCustomObjects.

PS>


Import-OfficeCsv -Path .\data.csv | Format-Table
        

Imports each row as a PSCustomObject.

Read rows as dictionaries.

PS>


Import-OfficeCsv -Path .\data.csv -AsHashtable | ForEach-Object { $_['Name'] }
        

Uses hashtables for dynamic schemas or key-based access.

Read rows as a DataTable.

PS>


Import-OfficeCsv -Path .\data.csv -AsDataTable
        

Emits one DataTable per input file for database and table-oriented workflows.

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

Import-OfficeCsv [-AllowEmptyLines] [-AsDataReader] [-AsDataTable] [-AsHashtable] [-CollectParseErrors] [-ColumnCountMismatchPolicy <Strict|PadMissingFieldsAndIgnoreExtraFields>] [-ColumnType <IDictionary>] [-CommentCharacter <Char>] [-CompressionType <Auto|GZip|Deflate|Brotli|ZLib>] [-Culture <CultureInfo>] [-DateTimeFormats <String[]>] [-Delimiter <Char>] [-DelimiterText <String>] [-DuplicateHeaderBehavior <Preserve|Rename|Throw>] [-Encoding <Encoding>] [-Header <String[]>] [-InferSchema] [-InternStrings] [-MaxDecompressedBytes <Nullable`1>] [-MaxFieldLength <Nullable`1>] [-MaxParseErrors <Int32>] [-MaxQuotedFieldLength <Nullable`1>] [-Mode <InMemory|Stream>] [-NoHeader] [-NormalizeQuotes] [-NullValue <String>] [-ParseErrorAction <Throw|SkipRow>] -Path <String[]> [-ProgressInterval <Nullable`1>] [-QuoteParsingMode <Lenient|Strict>] [-RecognizeW3CFieldsHeader <Boolean>] [-SchemaSampleSize <Int32>] [-SkipCommentRows] [-SkipCommentRowsBeforeHeader <Boolean>] [-SkipRows <Int32>] [-StaticColumns <IDictionary>] [-TrimWhitespace <Boolean>] [<CommonParameters>]
#
Parameter set: PathDelimiter

Parameters

AllowEmptyLines SwitchParameter optionalposition: namedpipeline: False
Allow empty lines in the input.
AsDataReader SwitchParameter optionalposition: namedpipeline: False
Emit a forward-only IDataReader for database bulk-copy workflows.
AsDataTable SwitchParameter optionalposition: namedpipeline: False
Emit one DataTable per input file instead of enumerating row objects.
AsHashtable SwitchParameter optionalposition: namedpipeline: False
Emit dictionaries instead of PSCustomObjects.
CollectParseErrors SwitchParameter optionalposition: namedpipeline: False
Collect parse errors and write them as non-terminating errors after each file.
ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy optionalposition: namedpipeline: Falsevalues: 2
Controls how rows with fewer or more fields than the header are handled.
Possible values: Strict, PadMissingFieldsAndIgnoreExtraFields
ColumnType IDictionary optionalposition: namedpipeline: False
Explicit column types used when emitting DataTable or IDataReader output.
CommentCharacter Char optionalposition: namedpipeline: False
Character that identifies comment rows.
CompressionType CsvCompressionType optionalposition: namedpipeline: Falsevalues: 5
Compression used when reading files. Auto infers from the file extension.
Possible values: Auto, GZip, Deflate, Brotli, ZLib
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
Encoding Encoding optionalposition: namedpipeline: False
Encoding used when reading the file.
Header String[] optionalposition: namedpipeline: False
Explicit header names to use; when provided, the first CSV record is treated as data.
InferSchema SwitchParameter optionalposition: namedpipeline: False
Infer typed columns when -AsDataTable or -AsDataReader is used.
InternStrings SwitchParameter optionalposition: namedpipeline: False
Reuse repeated string values through a per-read cache.
MaxDecompressedBytes Nullable`1 optionalposition: namedpipeline: False
Maximum decompressed bytes to read from compressed CSV files.
MaxFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for any parsed field.
MaxParseErrors Int32 optionalposition: namedpipeline: False
Maximum number of collected parse errors before parsing fails.
MaxQuotedFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for fields parsed from quoted records.
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.
NormalizeQuotes SwitchParameter optionalposition: namedpipeline: False
Normalize curly quote characters to straight quotes.
NullValue String optionalposition: namedpipeline: False
Token that is materialized as null when importing rows.
ParseErrorAction CsvParseErrorAction optionalposition: namedpipeline: Falsevalues: 2
How parse errors are handled.
Possible values: Throw, SkipRow
Path String[] requiredposition: 0pipeline: True (ByValue, ByPropertyName)aliases: FilePath
Path to one or more CSV files. Wildcards are supported.
ProgressInterval Nullable`1 optionalposition: namedpipeline: False
Report progress every N parsed records.
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.
SchemaSampleSize Int32 optionalposition: namedpipeline: False
Maximum row count inspected when schema inference is enabled.
SkipCommentRows SwitchParameter optionalposition: namedpipeline: False
Skip comment rows throughout the file.
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 imported row.
TrimWhitespace Boolean optionalposition: namedpipeline: False
Trim whitespace around unquoted fields.

Outputs

System.Object

Import-OfficeCsv [-AsDataReader] [-AsDataTable] [-AsHashtable] [-CollectParseErrors] [-ColumnType <IDictionary>] [-Document <CsvDocument>] [-InferSchema] [-InternStrings] [-MaxFieldLength <Nullable`1>] [-MaxParseErrors <Int32>] [-MaxQuotedFieldLength <Nullable`1>] [-NormalizeQuotes] [-ParseErrorAction <Throw|SkipRow>] [-ProgressInterval <Nullable`1>] [-SchemaSampleSize <Int32>] [<CommonParameters>]
#
Parameter set: Document

Parameters

AsDataReader SwitchParameter optionalposition: namedpipeline: False
Emit a forward-only IDataReader for database bulk-copy workflows.
AsDataTable SwitchParameter optionalposition: namedpipeline: False
Emit one DataTable per input file instead of enumerating row objects.
AsHashtable SwitchParameter optionalposition: namedpipeline: False
Emit dictionaries instead of PSCustomObjects.
CollectParseErrors SwitchParameter optionalposition: namedpipeline: False
Collect parse errors and write them as non-terminating errors after each file.
ColumnType IDictionary optionalposition: namedpipeline: False
Explicit column types used when emitting DataTable or IDataReader output.
Document CsvDocument optionalposition: namedpipeline: True (ByValue)
CSV document to read when already loaded.
InferSchema SwitchParameter optionalposition: namedpipeline: False
Infer typed columns when -AsDataTable or -AsDataReader is used.
InternStrings SwitchParameter optionalposition: namedpipeline: False
Reuse repeated string values through a per-read cache.
MaxFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for any parsed field.
MaxParseErrors Int32 optionalposition: namedpipeline: False
Maximum number of collected parse errors before parsing fails.
MaxQuotedFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for fields parsed from quoted records.
NormalizeQuotes SwitchParameter optionalposition: namedpipeline: False
Normalize curly quote characters to straight quotes.
ParseErrorAction CsvParseErrorAction optionalposition: namedpipeline: Falsevalues: 2
How parse errors are handled.
Possible values: Throw, SkipRow
ProgressInterval Nullable`1 optionalposition: namedpipeline: False
Report progress every N parsed records.
SchemaSampleSize Int32 optionalposition: namedpipeline: False
Maximum row count inspected when schema inference is enabled.

Outputs

System.Object

Import-OfficeCsv [-AllowEmptyLines] [-AsDataReader] [-AsDataTable] [-AsHashtable] [-CollectParseErrors] [-ColumnCountMismatchPolicy <Strict|PadMissingFieldsAndIgnoreExtraFields>] [-ColumnType <IDictionary>] [-CommentCharacter <Char>] [-CompressionType <Auto|GZip|Deflate|Brotli|ZLib>] [-Culture <CultureInfo>] [-DateTimeFormats <String[]>] [-DuplicateHeaderBehavior <Preserve|Rename|Throw>] [-Encoding <Encoding>] [-Header <String[]>] [-InferSchema] [-InternStrings] [-MaxDecompressedBytes <Nullable`1>] [-MaxFieldLength <Nullable`1>] [-MaxParseErrors <Int32>] [-MaxQuotedFieldLength <Nullable`1>] [-Mode <InMemory|Stream>] [-NoHeader] [-NormalizeQuotes] [-NullValue <String>] [-ParseErrorAction <Throw|SkipRow>] -Path <String[]> [-ProgressInterval <Nullable`1>] [-QuoteParsingMode <Lenient|Strict>] [-RecognizeW3CFieldsHeader <Boolean>] [-SchemaSampleSize <Int32>] [-SkipCommentRows] [-SkipCommentRowsBeforeHeader <Boolean>] [-SkipRows <Int32>] [-StaticColumns <IDictionary>] [-TrimWhitespace <Boolean>] -UseCulture [<CommonParameters>]
#
Parameter set: PathCulture

Parameters

AllowEmptyLines SwitchParameter optionalposition: namedpipeline: False
Allow empty lines in the input.
AsDataReader SwitchParameter optionalposition: namedpipeline: False
Emit a forward-only IDataReader for database bulk-copy workflows.
AsDataTable SwitchParameter optionalposition: namedpipeline: False
Emit one DataTable per input file instead of enumerating row objects.
AsHashtable SwitchParameter optionalposition: namedpipeline: False
Emit dictionaries instead of PSCustomObjects.
CollectParseErrors SwitchParameter optionalposition: namedpipeline: False
Collect parse errors and write them as non-terminating errors after each file.
ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy optionalposition: namedpipeline: Falsevalues: 2
Controls how rows with fewer or more fields than the header are handled.
Possible values: Strict, PadMissingFieldsAndIgnoreExtraFields
ColumnType IDictionary optionalposition: namedpipeline: False
Explicit column types used when emitting DataTable or IDataReader output.
CommentCharacter Char optionalposition: namedpipeline: False
Character that identifies comment rows.
CompressionType CsvCompressionType optionalposition: namedpipeline: Falsevalues: 5
Compression used when reading files. Auto infers from the file extension.
Possible values: Auto, GZip, Deflate, Brotli, ZLib
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
Encoding Encoding optionalposition: namedpipeline: False
Encoding used when reading the file.
Header String[] optionalposition: namedpipeline: False
Explicit header names to use; when provided, the first CSV record is treated as data.
InferSchema SwitchParameter optionalposition: namedpipeline: False
Infer typed columns when -AsDataTable or -AsDataReader is used.
InternStrings SwitchParameter optionalposition: namedpipeline: False
Reuse repeated string values through a per-read cache.
MaxDecompressedBytes Nullable`1 optionalposition: namedpipeline: False
Maximum decompressed bytes to read from compressed CSV files.
MaxFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for any parsed field.
MaxParseErrors Int32 optionalposition: namedpipeline: False
Maximum number of collected parse errors before parsing fails.
MaxQuotedFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for fields parsed from quoted records.
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.
NormalizeQuotes SwitchParameter optionalposition: namedpipeline: False
Normalize curly quote characters to straight quotes.
NullValue String optionalposition: namedpipeline: False
Token that is materialized as null when importing rows.
ParseErrorAction CsvParseErrorAction optionalposition: namedpipeline: Falsevalues: 2
How parse errors are handled.
Possible values: Throw, SkipRow
Path String[] requiredposition: 0pipeline: True (ByValue, ByPropertyName)aliases: FilePath
Path to one or more CSV files. Wildcards are supported.
ProgressInterval Nullable`1 optionalposition: namedpipeline: False
Report progress every N parsed records.
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.
SchemaSampleSize Int32 optionalposition: namedpipeline: False
Maximum row count inspected when schema inference is enabled.
SkipCommentRows SwitchParameter optionalposition: namedpipeline: False
Skip comment rows throughout the file.
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 imported row.
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

Import-OfficeCsv [-AllowEmptyLines] [-AsDataReader] [-AsDataTable] [-AsHashtable] [-CollectParseErrors] [-ColumnCountMismatchPolicy <Strict|PadMissingFieldsAndIgnoreExtraFields>] [-ColumnType <IDictionary>] [-CommentCharacter <Char>] [-CompressionType <Auto|GZip|Deflate|Brotli|ZLib>] [-Culture <CultureInfo>] [-DateTimeFormats <String[]>] [-DelimiterCandidates <Char[]>] -DetectDelimiter [-DuplicateHeaderBehavior <Preserve|Rename|Throw>] [-Encoding <Encoding>] [-Header <String[]>] [-InferSchema] [-InternStrings] [-MaxDecompressedBytes <Nullable`1>] [-MaxFieldLength <Nullable`1>] [-MaxParseErrors <Int32>] [-MaxQuotedFieldLength <Nullable`1>] [-Mode <InMemory|Stream>] [-NoHeader] [-NormalizeQuotes] [-NullValue <String>] [-ParseErrorAction <Throw|SkipRow>] -Path <String[]> [-ProgressInterval <Nullable`1>] [-QuoteParsingMode <Lenient|Strict>] [-RecognizeW3CFieldsHeader <Boolean>] [-SchemaSampleSize <Int32>] [-SkipCommentRows] [-SkipCommentRowsBeforeHeader <Boolean>] [-SkipRows <Int32>] [-StaticColumns <IDictionary>] [-TrimWhitespace <Boolean>] [<CommonParameters>]
#
Parameter set: PathDetect

Parameters

AllowEmptyLines SwitchParameter optionalposition: namedpipeline: False
Allow empty lines in the input.
AsDataReader SwitchParameter optionalposition: namedpipeline: False
Emit a forward-only IDataReader for database bulk-copy workflows.
AsDataTable SwitchParameter optionalposition: namedpipeline: False
Emit one DataTable per input file instead of enumerating row objects.
AsHashtable SwitchParameter optionalposition: namedpipeline: False
Emit dictionaries instead of PSCustomObjects.
CollectParseErrors SwitchParameter optionalposition: namedpipeline: False
Collect parse errors and write them as non-terminating errors after each file.
ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy optionalposition: namedpipeline: Falsevalues: 2
Controls how rows with fewer or more fields than the header are handled.
Possible values: Strict, PadMissingFieldsAndIgnoreExtraFields
ColumnType IDictionary optionalposition: namedpipeline: False
Explicit column types used when emitting DataTable or IDataReader output.
CommentCharacter Char optionalposition: namedpipeline: False
Character that identifies comment rows.
CompressionType CsvCompressionType optionalposition: namedpipeline: Falsevalues: 5
Compression used when reading files. Auto infers from the file extension.
Possible values: Auto, GZip, Deflate, Brotli, ZLib
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
Encoding Encoding optionalposition: namedpipeline: False
Encoding used when reading the file.
Header String[] optionalposition: namedpipeline: False
Explicit header names to use; when provided, the first CSV record is treated as data.
InferSchema SwitchParameter optionalposition: namedpipeline: False
Infer typed columns when -AsDataTable or -AsDataReader is used.
InternStrings SwitchParameter optionalposition: namedpipeline: False
Reuse repeated string values through a per-read cache.
MaxDecompressedBytes Nullable`1 optionalposition: namedpipeline: False
Maximum decompressed bytes to read from compressed CSV files.
MaxFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for any parsed field.
MaxParseErrors Int32 optionalposition: namedpipeline: False
Maximum number of collected parse errors before parsing fails.
MaxQuotedFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for fields parsed from quoted records.
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.
NormalizeQuotes SwitchParameter optionalposition: namedpipeline: False
Normalize curly quote characters to straight quotes.
NullValue String optionalposition: namedpipeline: False
Token that is materialized as null when importing rows.
ParseErrorAction CsvParseErrorAction optionalposition: namedpipeline: Falsevalues: 2
How parse errors are handled.
Possible values: Throw, SkipRow
Path String[] requiredposition: 0pipeline: True (ByValue, ByPropertyName)aliases: FilePath
Path to one or more CSV files. Wildcards are supported.
ProgressInterval Nullable`1 optionalposition: namedpipeline: False
Report progress every N parsed records.
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.
SchemaSampleSize Int32 optionalposition: namedpipeline: False
Maximum row count inspected when schema inference is enabled.
SkipCommentRows SwitchParameter optionalposition: namedpipeline: False
Skip comment rows throughout the file.
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 imported row.
TrimWhitespace Boolean optionalposition: namedpipeline: False
Trim whitespace around unquoted fields.

Outputs

System.Object

Import-OfficeCsv [-AllowEmptyLines] [-AsDataReader] [-AsDataTable] [-AsHashtable] [-CollectParseErrors] [-ColumnCountMismatchPolicy <Strict|PadMissingFieldsAndIgnoreExtraFields>] [-ColumnType <IDictionary>] [-CommentCharacter <Char>] [-CompressionType <Auto|GZip|Deflate|Brotli|ZLib>] [-Culture <CultureInfo>] [-DateTimeFormats <String[]>] [-Delimiter <Char>] [-DelimiterText <String>] [-DuplicateHeaderBehavior <Preserve|Rename|Throw>] [-Encoding <Encoding>] [-Header <String[]>] [-InferSchema] [-InternStrings] -LiteralPath <String[]> [-MaxDecompressedBytes <Nullable`1>] [-MaxFieldLength <Nullable`1>] [-MaxParseErrors <Int32>] [-MaxQuotedFieldLength <Nullable`1>] [-Mode <InMemory|Stream>] [-NoHeader] [-NormalizeQuotes] [-NullValue <String>] [-ParseErrorAction <Throw|SkipRow>] [-ProgressInterval <Nullable`1>] [-QuoteParsingMode <Lenient|Strict>] [-RecognizeW3CFieldsHeader <Boolean>] [-SchemaSampleSize <Int32>] [-SkipCommentRows] [-SkipCommentRowsBeforeHeader <Boolean>] [-SkipRows <Int32>] [-StaticColumns <IDictionary>] [-TrimWhitespace <Boolean>] [<CommonParameters>]
#
Parameter set: LiteralPathDelimiter

Parameters

AllowEmptyLines SwitchParameter optionalposition: namedpipeline: False
Allow empty lines in the input.
AsDataReader SwitchParameter optionalposition: namedpipeline: False
Emit a forward-only IDataReader for database bulk-copy workflows.
AsDataTable SwitchParameter optionalposition: namedpipeline: False
Emit one DataTable per input file instead of enumerating row objects.
AsHashtable SwitchParameter optionalposition: namedpipeline: False
Emit dictionaries instead of PSCustomObjects.
CollectParseErrors SwitchParameter optionalposition: namedpipeline: False
Collect parse errors and write them as non-terminating errors after each file.
ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy optionalposition: namedpipeline: Falsevalues: 2
Controls how rows with fewer or more fields than the header are handled.
Possible values: Strict, PadMissingFieldsAndIgnoreExtraFields
ColumnType IDictionary optionalposition: namedpipeline: False
Explicit column types used when emitting DataTable or IDataReader output.
CommentCharacter Char optionalposition: namedpipeline: False
Character that identifies comment rows.
CompressionType CsvCompressionType optionalposition: namedpipeline: Falsevalues: 5
Compression used when reading files. Auto infers from the file extension.
Possible values: Auto, GZip, Deflate, Brotli, ZLib
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
Encoding Encoding optionalposition: namedpipeline: False
Encoding used when reading the file.
Header String[] optionalposition: namedpipeline: False
Explicit header names to use; when provided, the first CSV record is treated as data.
InferSchema SwitchParameter optionalposition: namedpipeline: False
Infer typed columns when -AsDataTable or -AsDataReader is used.
InternStrings SwitchParameter optionalposition: namedpipeline: False
Reuse repeated string values through a per-read cache.
LiteralPath String[] requiredposition: namedpipeline: True (ByPropertyName)aliases: LP, PSPath
Literal path to one or more CSV files.
MaxDecompressedBytes Nullable`1 optionalposition: namedpipeline: False
Maximum decompressed bytes to read from compressed CSV files.
MaxFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for any parsed field.
MaxParseErrors Int32 optionalposition: namedpipeline: False
Maximum number of collected parse errors before parsing fails.
MaxQuotedFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for fields parsed from quoted records.
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.
NormalizeQuotes SwitchParameter optionalposition: namedpipeline: False
Normalize curly quote characters to straight quotes.
NullValue String optionalposition: namedpipeline: False
Token that is materialized as null when importing rows.
ParseErrorAction CsvParseErrorAction optionalposition: namedpipeline: Falsevalues: 2
How parse errors are handled.
Possible values: Throw, SkipRow
ProgressInterval Nullable`1 optionalposition: namedpipeline: False
Report progress every N parsed records.
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.
SchemaSampleSize Int32 optionalposition: namedpipeline: False
Maximum row count inspected when schema inference is enabled.
SkipCommentRows SwitchParameter optionalposition: namedpipeline: False
Skip comment rows throughout the file.
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 imported row.
TrimWhitespace Boolean optionalposition: namedpipeline: False
Trim whitespace around unquoted fields.

Outputs

System.Object

Import-OfficeCsv [-AllowEmptyLines] [-AsDataReader] [-AsDataTable] [-AsHashtable] [-CollectParseErrors] [-ColumnCountMismatchPolicy <Strict|PadMissingFieldsAndIgnoreExtraFields>] [-ColumnType <IDictionary>] [-CommentCharacter <Char>] [-CompressionType <Auto|GZip|Deflate|Brotli|ZLib>] [-Culture <CultureInfo>] [-DateTimeFormats <String[]>] [-DuplicateHeaderBehavior <Preserve|Rename|Throw>] [-Encoding <Encoding>] [-Header <String[]>] [-InferSchema] [-InternStrings] -LiteralPath <String[]> [-MaxDecompressedBytes <Nullable`1>] [-MaxFieldLength <Nullable`1>] [-MaxParseErrors <Int32>] [-MaxQuotedFieldLength <Nullable`1>] [-Mode <InMemory|Stream>] [-NoHeader] [-NormalizeQuotes] [-NullValue <String>] [-ParseErrorAction <Throw|SkipRow>] [-ProgressInterval <Nullable`1>] [-QuoteParsingMode <Lenient|Strict>] [-RecognizeW3CFieldsHeader <Boolean>] [-SchemaSampleSize <Int32>] [-SkipCommentRows] [-SkipCommentRowsBeforeHeader <Boolean>] [-SkipRows <Int32>] [-StaticColumns <IDictionary>] [-TrimWhitespace <Boolean>] -UseCulture [<CommonParameters>]
#
Parameter set: LiteralPathCulture

Parameters

AllowEmptyLines SwitchParameter optionalposition: namedpipeline: False
Allow empty lines in the input.
AsDataReader SwitchParameter optionalposition: namedpipeline: False
Emit a forward-only IDataReader for database bulk-copy workflows.
AsDataTable SwitchParameter optionalposition: namedpipeline: False
Emit one DataTable per input file instead of enumerating row objects.
AsHashtable SwitchParameter optionalposition: namedpipeline: False
Emit dictionaries instead of PSCustomObjects.
CollectParseErrors SwitchParameter optionalposition: namedpipeline: False
Collect parse errors and write them as non-terminating errors after each file.
ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy optionalposition: namedpipeline: Falsevalues: 2
Controls how rows with fewer or more fields than the header are handled.
Possible values: Strict, PadMissingFieldsAndIgnoreExtraFields
ColumnType IDictionary optionalposition: namedpipeline: False
Explicit column types used when emitting DataTable or IDataReader output.
CommentCharacter Char optionalposition: namedpipeline: False
Character that identifies comment rows.
CompressionType CsvCompressionType optionalposition: namedpipeline: Falsevalues: 5
Compression used when reading files. Auto infers from the file extension.
Possible values: Auto, GZip, Deflate, Brotli, ZLib
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
Encoding Encoding optionalposition: namedpipeline: False
Encoding used when reading the file.
Header String[] optionalposition: namedpipeline: False
Explicit header names to use; when provided, the first CSV record is treated as data.
InferSchema SwitchParameter optionalposition: namedpipeline: False
Infer typed columns when -AsDataTable or -AsDataReader is used.
InternStrings SwitchParameter optionalposition: namedpipeline: False
Reuse repeated string values through a per-read cache.
LiteralPath String[] requiredposition: namedpipeline: True (ByPropertyName)aliases: LP, PSPath
Literal path to one or more CSV files.
MaxDecompressedBytes Nullable`1 optionalposition: namedpipeline: False
Maximum decompressed bytes to read from compressed CSV files.
MaxFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for any parsed field.
MaxParseErrors Int32 optionalposition: namedpipeline: False
Maximum number of collected parse errors before parsing fails.
MaxQuotedFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for fields parsed from quoted records.
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.
NormalizeQuotes SwitchParameter optionalposition: namedpipeline: False
Normalize curly quote characters to straight quotes.
NullValue String optionalposition: namedpipeline: False
Token that is materialized as null when importing rows.
ParseErrorAction CsvParseErrorAction optionalposition: namedpipeline: Falsevalues: 2
How parse errors are handled.
Possible values: Throw, SkipRow
ProgressInterval Nullable`1 optionalposition: namedpipeline: False
Report progress every N parsed records.
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.
SchemaSampleSize Int32 optionalposition: namedpipeline: False
Maximum row count inspected when schema inference is enabled.
SkipCommentRows SwitchParameter optionalposition: namedpipeline: False
Skip comment rows throughout the file.
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 imported row.
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

Import-OfficeCsv [-AllowEmptyLines] [-AsDataReader] [-AsDataTable] [-AsHashtable] [-CollectParseErrors] [-ColumnCountMismatchPolicy <Strict|PadMissingFieldsAndIgnoreExtraFields>] [-ColumnType <IDictionary>] [-CommentCharacter <Char>] [-CompressionType <Auto|GZip|Deflate|Brotli|ZLib>] [-Culture <CultureInfo>] [-DateTimeFormats <String[]>] [-DelimiterCandidates <Char[]>] -DetectDelimiter [-DuplicateHeaderBehavior <Preserve|Rename|Throw>] [-Encoding <Encoding>] [-Header <String[]>] [-InferSchema] [-InternStrings] -LiteralPath <String[]> [-MaxDecompressedBytes <Nullable`1>] [-MaxFieldLength <Nullable`1>] [-MaxParseErrors <Int32>] [-MaxQuotedFieldLength <Nullable`1>] [-Mode <InMemory|Stream>] [-NoHeader] [-NormalizeQuotes] [-NullValue <String>] [-ParseErrorAction <Throw|SkipRow>] [-ProgressInterval <Nullable`1>] [-QuoteParsingMode <Lenient|Strict>] [-RecognizeW3CFieldsHeader <Boolean>] [-SchemaSampleSize <Int32>] [-SkipCommentRows] [-SkipCommentRowsBeforeHeader <Boolean>] [-SkipRows <Int32>] [-StaticColumns <IDictionary>] [-TrimWhitespace <Boolean>] [<CommonParameters>]
#
Parameter set: LiteralPathDetect

Parameters

AllowEmptyLines SwitchParameter optionalposition: namedpipeline: False
Allow empty lines in the input.
AsDataReader SwitchParameter optionalposition: namedpipeline: False
Emit a forward-only IDataReader for database bulk-copy workflows.
AsDataTable SwitchParameter optionalposition: namedpipeline: False
Emit one DataTable per input file instead of enumerating row objects.
AsHashtable SwitchParameter optionalposition: namedpipeline: False
Emit dictionaries instead of PSCustomObjects.
CollectParseErrors SwitchParameter optionalposition: namedpipeline: False
Collect parse errors and write them as non-terminating errors after each file.
ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy optionalposition: namedpipeline: Falsevalues: 2
Controls how rows with fewer or more fields than the header are handled.
Possible values: Strict, PadMissingFieldsAndIgnoreExtraFields
ColumnType IDictionary optionalposition: namedpipeline: False
Explicit column types used when emitting DataTable or IDataReader output.
CommentCharacter Char optionalposition: namedpipeline: False
Character that identifies comment rows.
CompressionType CsvCompressionType optionalposition: namedpipeline: Falsevalues: 5
Compression used when reading files. Auto infers from the file extension.
Possible values: Auto, GZip, Deflate, Brotli, ZLib
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
Encoding Encoding optionalposition: namedpipeline: False
Encoding used when reading the file.
Header String[] optionalposition: namedpipeline: False
Explicit header names to use; when provided, the first CSV record is treated as data.
InferSchema SwitchParameter optionalposition: namedpipeline: False
Infer typed columns when -AsDataTable or -AsDataReader is used.
InternStrings SwitchParameter optionalposition: namedpipeline: False
Reuse repeated string values through a per-read cache.
LiteralPath String[] requiredposition: namedpipeline: True (ByPropertyName)aliases: LP, PSPath
Literal path to one or more CSV files.
MaxDecompressedBytes Nullable`1 optionalposition: namedpipeline: False
Maximum decompressed bytes to read from compressed CSV files.
MaxFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for any parsed field.
MaxParseErrors Int32 optionalposition: namedpipeline: False
Maximum number of collected parse errors before parsing fails.
MaxQuotedFieldLength Nullable`1 optionalposition: namedpipeline: False
Maximum length allowed for fields parsed from quoted records.
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.
NormalizeQuotes SwitchParameter optionalposition: namedpipeline: False
Normalize curly quote characters to straight quotes.
NullValue String optionalposition: namedpipeline: False
Token that is materialized as null when importing rows.
ParseErrorAction CsvParseErrorAction optionalposition: namedpipeline: Falsevalues: 2
How parse errors are handled.
Possible values: Throw, SkipRow
ProgressInterval Nullable`1 optionalposition: namedpipeline: False
Report progress every N parsed records.
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.
SchemaSampleSize Int32 optionalposition: namedpipeline: False
Maximum row count inspected when schema inference is enabled.
SkipCommentRows SwitchParameter optionalposition: namedpipeline: False
Skip comment rows throughout the file.
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 imported row.
TrimWhitespace Boolean optionalposition: namedpipeline: False
Trim whitespace around unquoted fields.

Outputs

System.Object