# Import-OfficeCsv

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

Project

PSWriteOffice

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

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **725**

Forks **84**

Open issues **3**

Total downloads **5,231,343**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-23

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.CSV.CsvDocument` `System.String[]`

**Source**

[ImportOfficeCsvCommand.cs:35](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Csv/ImportOfficeCsvCommand.cs#L35) 

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

## 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 <Int64>]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-Mode <Stream|InMemory>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw|SkipRow>]
[-Path] <String[]>
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient|Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SchemaSampleSize <Int32>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
[-TrimWhitespace <Boolean>]
[<CommonParameters>]
```

[#](#member-57e06b3c8441c7bd0ca1ab0b)

Parameter set: `PathDelimiter`

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

[#](#member-2b1c0743fd271d355d53c447)

Parameter set: `Document`

```
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 <Int64>]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-Mode <Stream|InMemory>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw|SkipRow>]
[-Path] <String[]>
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient|Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SchemaSampleSize <Int32>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
[-TrimWhitespace <Boolean>]
-UseCulture
[<CommonParameters>]
```

[#](#member-2f2d42cd0d03ed6e7c539188)

Parameter set: `PathCulture`

```
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 <Int64>]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-Mode <Stream|InMemory>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw|SkipRow>]
[-Path] <String[]>
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient|Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SchemaSampleSize <Int32>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
[-TrimWhitespace <Boolean>]
[<CommonParameters>]
```

[#](#member-906a417a0e7e2029b6fee4ca)

Parameter set: `PathDetect`

```
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 <Int64>]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-Mode <Stream|InMemory>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw|SkipRow>]
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient|Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SchemaSampleSize <Int32>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
[-TrimWhitespace <Boolean>]
[<CommonParameters>]
```

[#](#member-3df0ed1d20dd20fc7f8b7575)

Parameter set: `LiteralPathDelimiter`

```
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 <Int64>]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-Mode <Stream|InMemory>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw|SkipRow>]
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient|Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SchemaSampleSize <Int32>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
[-TrimWhitespace <Boolean>]
-UseCulture
[<CommonParameters>]
```

[#](#member-6ff81f1e8e3352bc5d1a41ed)

Parameter set: `LiteralPathCulture`

```
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 <Int64>]
[-MaxFieldLength <Int32>]
[-MaxParseErrors <Int32>]
[-MaxQuotedFieldLength <Int32>]
[-Mode <Stream|InMemory>]
[-NoHeader]
[-NormalizeQuotes]
[-NullValue <String>]
[-ParseErrorAction <Throw|SkipRow>]
[-ProgressInterval <Int32>]
[-QuoteParsingMode <Lenient|Strict>]
[-RecognizeW3CFieldsHeader <Boolean>]
[-SchemaSampleSize <Int32>]
[-SkipCommentRows]
[-SkipCommentRowsBeforeHeader <Boolean>]
[-SkipRows <Int32>]
[-StaticColumns <IDictionary>]
[-TrimWhitespace <Boolean>]
[<CommonParameters>]
```

[#](#member-053684c35ec859716ac73112)

Parameter set: `LiteralPathDetect`

## Description

Uses the CSV header to map fields to property names.

## Examples

### Read rows as PSCustomObjects.

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

Imports each row as a PSCustomObject.

### Read rows as dictionaries.

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

Uses hashtables for dynamic schemas or key-based access.

### Read rows as a DataTable.

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

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

## Parameters

**-AllowEmptyLines SwitchParameter optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Allow empty lines in the input.

**-AsDataReader SwitchParameter optional**

Emit a forward-only IDataReader for database bulk-copy workflows.

**-AsDataTable SwitchParameter optional**

Emit one DataTable per input file instead of enumerating row objects.

**-AsHashtable SwitchParameter optional**

Emit dictionaries instead of PSCustomObjects.

**-CollectParseErrors SwitchParameter optional**

Collect parse errors and write them as non-terminating errors after each file.

**-ColumnCountMismatchPolicy CsvColumnCountMismatchPolicy optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Controls how rows with fewer or more fields than the header are handled.

Possible values: `Strict`, `PadMissingFieldsAndIgnoreExtraFields`

**-ColumnType IDictionary optional**

Explicit column types used when emitting DataTable or IDataReader output.

**-CommentCharacter Char optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

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 optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Culture used for type conversions.

**-DateTimeFormats String[] optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Additional date/time formats used by typed conversions and validation.

**-Delimiter Char optionalsets: PathDelimiter, LiteralPathDelimiter**

Field delimiter character.

**-DelimiterText String optionalsets: PathDelimiter, LiteralPathDelimiter**

Field delimiter text for multi-character delimiters such as || or ::.

**-DuplicateHeaderBehavior CsvDuplicateHeaderBehavior optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

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[] optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Explicit header names to use; when provided, the first CSV record is treated as data.

**-InferSchema SwitchParameter optional**

Infer typed columns when -AsDataTable or -AsDataReader is used.

**-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.

**-Mode CsvReadMode optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Load mode controlling materialization.

Possible values: `Stream`, `InMemory`

**-NoHeader SwitchParameter optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Treat the first record as data and generate default column names.

**-NormalizeQuotes SwitchParameter optional**

Normalize curly quote characters to straight quotes.

**-NullValue String optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Token that is materialized as null when importing rows.

**-ParseErrorAction CsvParseErrorAction optional**

How parse errors are handled.

Possible values: `Throw`, `SkipRow`

**-Path String[] requiredposition: 0pipeline: True (ByValue, ByPropertyName)aliases: FilePathsets: PathDelimiter, PathCulture, PathDetect**

Path to one or more CSV files. Wildcards are supported.

**-ProgressInterval Int32 optional**

Report progress every N parsed records.

**-QuoteParsingMode CsvQuoteParsingMode optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Controls whether malformed quoted fields are parsed leniently or rejected.

Possible values: `Lenient`, `Strict`

**-RecognizeW3CFieldsHeader Boolean optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Recognize W3C Extended Log File Format #Fields: rows as headers.

**-SchemaSampleSize Int32 optional**

Maximum row count inspected when schema inference is enabled.

**-SkipCommentRows SwitchParameter optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Skip comment rows throughout the file.

**-SkipCommentRowsBeforeHeader Boolean optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Skip comment rows starting with # while discovering the header.

**-SkipRows Int32 optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Number of parsed CSV records to skip before header discovery or data output.

**-StaticColumns IDictionary optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Static columns appended to every imported row.

**-TrimWhitespace Boolean optionalsets: PathDelimiter, PathCulture, PathDetect, LiteralPathDelimiter, LiteralPathCulture, LiteralPathDetect**

Trim whitespace around unquoted fields.

**-Document CsvDocument optionalpipeline: True (ByValue)sets: Document**

CSV document to read when already loaded.

**-UseCulture SwitchParameter requiredsets: PathCulture, LiteralPathCulture**

Use the list separator from the selected or current culture as the delimiter.

**-DelimiterCandidates Char[] optionalsets: PathDetect, LiteralPathDetect**

Delimiter candidates to consider when detecting the delimiter.

**-DetectDelimiter SwitchParameter requiredsets: PathDetect, LiteralPathDetect**

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.

## 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:5B46481BBE238EFEEF9E4469D6E2479E783875E44A222A7B1CEFBC1B9AA89ADC -->
