Cmdlet
Export-OfficeCsv
Exports objects or a CSV document to a CSV file.
Syntax
Export-OfficeCsv
[-Append]
[-CompressionLevel <Optimal| Fastest| NoCompression| SmallestSize>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormat <String>]
[-Delimiter <String>]
[-Encoding <Encoding>]
[-EscapeCharacter <Char>]
[-Force]
[-FormulaInjectionPolicy <Preserve| Escape>]
-InputObject <Object>
[-MaxCollectionItems <Int32>]
[-MaxNestingDepth <Int32>]
[-NewLine <String>]
[-NoClobber]
[-NoHeader]
[-NullValue <String>]
[-PassThru]
[-Path] <String>
[-QuoteCharacter <Char>]
[-QuoteFields <String[]>]
[-UseQuotes <AsNeeded| Always| Never>]
[-UseUtc]
[-WhatIf]
[-Confirm]
[<CommonParameters>]#Parameter set:
InputObjectPathExport-OfficeCsv
[-Append]
[-CompressionLevel <Optimal| Fastest| NoCompression| SmallestSize>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormat <String>]
[-Encoding <Encoding>]
[-EscapeCharacter <Char>]
[-Force]
[-FormulaInjectionPolicy <Preserve| Escape>]
-InputObject <Object>
[-MaxCollectionItems <Int32>]
[-MaxNestingDepth <Int32>]
[-NewLine <String>]
[-NoClobber]
[-NoHeader]
[-NullValue <String>]
[-PassThru]
[-Path] <String>
[-QuoteCharacter <Char>]
[-QuoteFields <String[]>]
-UseCulture
[-UseQuotes <AsNeeded| Always| Never>]
[-UseUtc]
[-WhatIf]
[-Confirm]
[<CommonParameters>]#Parameter set:
InputObjectPathCultureExport-OfficeCsv
[-Append]
[-CompressionLevel <Optimal| Fastest| NoCompression| SmallestSize>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormat <String>]
[-Delimiter <String>]
[-Encoding <Encoding>]
[-EscapeCharacter <Char>]
[-Force]
[-FormulaInjectionPolicy <Preserve| Escape>]
-InputObject <Object>
-LiteralPath <String>
[-MaxCollectionItems <Int32>]
[-MaxNestingDepth <Int32>]
[-NewLine <String>]
[-NoClobber]
[-NoHeader]
[-NullValue <String>]
[-PassThru]
[-QuoteCharacter <Char>]
[-QuoteFields <String[]>]
[-UseQuotes <AsNeeded| Always| Never>]
[-UseUtc]
[-WhatIf]
[-Confirm]
[<CommonParameters>]#Parameter set:
InputObjectLiteralPathExport-OfficeCsv
[-Append]
[-CompressionLevel <Optimal| Fastest| NoCompression| SmallestSize>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormat <String>]
[-Encoding <Encoding>]
[-EscapeCharacter <Char>]
[-Force]
[-FormulaInjectionPolicy <Preserve| Escape>]
-InputObject <Object>
-LiteralPath <String>
[-MaxCollectionItems <Int32>]
[-MaxNestingDepth <Int32>]
[-NewLine <String>]
[-NoClobber]
[-NoHeader]
[-NullValue <String>]
[-PassThru]
[-QuoteCharacter <Char>]
[-QuoteFields <String[]>]
-UseCulture
[-UseQuotes <AsNeeded| Always| Never>]
[-UseUtc]
[-WhatIf]
[-Confirm]
[<CommonParameters>]#Parameter set:
InputObjectLiteralPathCultureDescription
Use ConvertTo-OfficeCsv when the destination should be CSV text in the pipeline.
Examples
Export objects to a CSV file.
$data | Export-OfficeCsv -Path .\export.csvStreams PowerShell objects into a CSV file.
Export with culture list separator.
$data | Export-OfficeCsv -Path .\export.csv -UseCulture -Culture pl-PLUses the selected culture list separator as the delimiter.
Parameters
- -Append SwitchParameter
- Append rows to an existing CSV file. Existing headers are reused when present.
- -CompressionLevel CompressionLevel
- Compression level used when CompressionType is enabled.
- Possible values:
Optimal,Fastest,NoCompression,SmallestSize - -CompressionType CsvCompressionType
- Compression used when writing the CSV file.
- Possible values:
Auto,GZip,Deflate,Brotli,ZLib - -Culture CultureInfo
- Culture used for value formatting.
- -DateTimeFormat String
- Date/time format used for DateTime and DateTimeOffset values.
- -Delimiter String
- Field delimiter text, including multi-character separators.
- -Encoding Encoding
- Encoding used when writing files.
- -EscapeCharacter Char
- Character written before the quote character, and before itself, inside quoted fields, such as a backslash. Leave unset to double the quote character.
- -Force SwitchParameter
- Allow overwriting read-only files and appending rows with missing existing columns.
- -FormulaInjectionPolicy CsvFormulaInjectionPolicy
- Controls how formula-like values are written.
- Possible values:
Preserve,Escape - -InputObject Object
- Objects to export into CSV rows, or a CsvDocument to export (alias Document).
- -MaxCollectionItems Int32
- Maximum number of items allowed in one nested collection or dictionary field. Defaults to 1,048,575; increase explicitly for trusted larger values.
- -MaxNestingDepth Int32
- Maximum nesting depth allowed while normalizing one field value. Defaults to 64; increase explicitly for trusted deeper values.
- -NewLine String
- Override the newline sequence.
- -NoClobber SwitchParameter
- Do not overwrite an existing CSV file.
- -NoHeader SwitchParameter
- Omit the header row from the output.
- -NullValue String
- Token written for null values.
- -PassThru SwitchParameter
- Emit a FileInfo for the exported file.
- -Path String
- Destination CSV path.
- -QuoteCharacter Char
- Character that encloses quoted fields. Defaults to the double quote; fields that contain it are quoted.
- -QuoteFields String[]
- Field names that should always be quoted when UseQuotes is AsNeeded.
- -UseQuotes CsvQuoteMode
- Controls when CSV fields are quoted. Defaults to quoting only fields that need it.
- Possible values:
AsNeeded,Always,Never - -UseUtc SwitchParameter
- Convert date/time values to UTC before formatting.
- -WhatIf SwitchParameter
- Shows what would happen if the command runs.
- -Confirm SwitchParameter
- Prompts for confirmation before running the command.
- -UseCulture SwitchParameter
- Use the list separator from the selected or current culture as the delimiter.
- -LiteralPath String
- Literal destination CSV path. Wildcards are not expanded.
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.