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 <Char>]
[-DelimiterText <String>]
[-Encoding <Encoding>]
[-Force]
[-FormulaInjectionPolicy <Preserve| Escape>]
[-InputObject <Object>]
[-MaxCollectionItems <Int32>]
[-MaxNestingDepth <Int32>]
[-NewLine <String>]
[-NoClobber]
[-NoHeader]
[-NullValue <String>]
[-PassThru]
[-Path] <String>
[-QuoteFields <String[]>]
[-UseQuotes <AsNeeded| Always| Never>]
[-UseUtc]
[<CommonParameters>]#Parameter set:
InputObjectPathDelimiterExport-OfficeCsv
[-Append]
[-CompressionLevel <Optimal| Fastest| NoCompression| SmallestSize>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormat <String>]
[-Encoding <Encoding>]
[-Force]
[-FormulaInjectionPolicy <Preserve| Escape>]
[-InputObject <Object>]
[-MaxCollectionItems <Int32>]
[-MaxNestingDepth <Int32>]
[-NewLine <String>]
[-NoClobber]
[-NoHeader]
[-NullValue <String>]
[-PassThru]
[-Path] <String>
[-QuoteFields <String[]>]
-UseCulture
[-UseQuotes <AsNeeded| Always| Never>]
[-UseUtc]
[<CommonParameters>]#Parameter set:
InputObjectPathCultureExport-OfficeCsv
[-Append]
[-CompressionLevel <Optimal| Fastest| NoCompression| SmallestSize>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormat <String>]
[-Delimiter <Char>]
[-DelimiterText <String>]
[-Encoding <Encoding>]
[-Force]
[-FormulaInjectionPolicy <Preserve| Escape>]
[-InputObject <Object>]
-LiteralPath <String>
[-MaxCollectionItems <Int32>]
[-MaxNestingDepth <Int32>]
[-NewLine <String>]
[-NoClobber]
[-NoHeader]
[-NullValue <String>]
[-PassThru]
[-QuoteFields <String[]>]
[-UseQuotes <AsNeeded| Always| Never>]
[-UseUtc]
[<CommonParameters>]#Parameter set:
InputObjectLiteralPathDelimiterExport-OfficeCsv
[-Append]
[-CompressionLevel <Optimal| Fastest| NoCompression| SmallestSize>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormat <String>]
[-Encoding <Encoding>]
[-Force]
[-FormulaInjectionPolicy <Preserve| Escape>]
[-InputObject <Object>]
-LiteralPath <String>
[-MaxCollectionItems <Int32>]
[-MaxNestingDepth <Int32>]
[-NewLine <String>]
[-NoClobber]
[-NoHeader]
[-NullValue <String>]
[-PassThru]
[-QuoteFields <String[]>]
-UseCulture
[-UseQuotes <AsNeeded| Always| Never>]
[-UseUtc]
[<CommonParameters>]#Parameter set:
InputObjectLiteralPathCultureExport-OfficeCsv
[-Append]
[-CompressionLevel <Optimal| Fastest| NoCompression| SmallestSize>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormat <String>]
[-Delimiter <Char>]
[-DelimiterText <String>]
-Document <CsvDocument>
[-Encoding <Encoding>]
[-Force]
[-FormulaInjectionPolicy <Preserve| Escape>]
[-NewLine <String>]
[-NoClobber]
[-NoHeader]
[-NullValue <String>]
[-PassThru]
[-Path] <String>
[-QuoteFields <String[]>]
[-UseQuotes <AsNeeded| Always| Never>]
[-UseUtc]
[<CommonParameters>]#Parameter set:
DocumentPathDelimiterExport-OfficeCsv
[-Append]
[-CompressionLevel <Optimal| Fastest| NoCompression| SmallestSize>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormat <String>]
-Document <CsvDocument>
[-Encoding <Encoding>]
[-Force]
[-FormulaInjectionPolicy <Preserve| Escape>]
[-NewLine <String>]
[-NoClobber]
[-NoHeader]
[-NullValue <String>]
[-PassThru]
[-Path] <String>
[-QuoteFields <String[]>]
-UseCulture
[-UseQuotes <AsNeeded| Always| Never>]
[-UseUtc]
[<CommonParameters>]#Parameter set:
DocumentPathCultureExport-OfficeCsv
[-Append]
[-CompressionLevel <Optimal| Fastest| NoCompression| SmallestSize>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormat <String>]
[-Delimiter <Char>]
[-DelimiterText <String>]
-Document <CsvDocument>
[-Encoding <Encoding>]
[-Force]
[-FormulaInjectionPolicy <Preserve| Escape>]
-LiteralPath <String>
[-NewLine <String>]
[-NoClobber]
[-NoHeader]
[-NullValue <String>]
[-PassThru]
[-QuoteFields <String[]>]
[-UseQuotes <AsNeeded| Always| Never>]
[-UseUtc]
[<CommonParameters>]#Parameter set:
DocumentLiteralPathDelimiterExport-OfficeCsv
[-Append]
[-CompressionLevel <Optimal| Fastest| NoCompression| SmallestSize>]
[-CompressionType <Auto| GZip| Deflate| Brotli| ZLib>]
[-Culture <CultureInfo>]
[-DateTimeFormat <String>]
-Document <CsvDocument>
[-Encoding <Encoding>]
[-Force]
[-FormulaInjectionPolicy <Preserve| Escape>]
-LiteralPath <String>
[-NewLine <String>]
[-NoClobber]
[-NoHeader]
[-NullValue <String>]
[-PassThru]
[-QuoteFields <String[]>]
-UseCulture
[-UseQuotes <AsNeeded| Always| Never>]
[-UseUtc]
[<CommonParameters>]#Parameter set:
DocumentLiteralPathCultureDescription
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 Char
- Field delimiter character.
- -DelimiterText String
- Field delimiter text for multi-character delimiters such as || or ::.
- -Encoding Encoding
- Encoding used when writing files.
- -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.
- -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.
- -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.
- -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.
- -Document CsvDocument
- CSV document to export.
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.