Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Export-OfficeCsv

Module PSWriteOffice
Inputs
OfficeIMO.CSV.CsvDocument System.Object
Outputs
System.IO.FileInfo

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: InputObjectPathDelimiter
Export-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: InputObjectPathCulture
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>] -LiteralPath <String> [-MaxCollectionItems <Int32>] [-MaxNestingDepth <Int32>] [-NewLine <String>] [-NoClobber] [-NoHeader] [-NullValue <String>] [-PassThru] [-QuoteFields <String[]>] [-UseQuotes <AsNeeded|Always|Never>] [-UseUtc] [<CommonParameters>]
#
Parameter set: InputObjectLiteralPathDelimiter
Export-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: InputObjectLiteralPathCulture
Export-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: DocumentPathDelimiter
Export-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: DocumentPathCulture
Export-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: DocumentLiteralPathDelimiter
Export-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: DocumentLiteralPathCulture

Description

Use ConvertTo-OfficeCsv when the destination should be CSV text in the pipeline.

Examples

Authored help example

Export objects to a CSV file.

$data | Export-OfficeCsv -Path .\export.csv

Streams PowerShell objects into a CSV file.

Export with culture list separator.

$data | Export-OfficeCsv -Path .\export.csv -UseCulture -Culture pl-PL

Uses the selected culture list separator as the delimiter.

Parameters

-Append SwitchParameter optional
Append rows to an existing CSV file. Existing headers are reused when present.
-CompressionLevel CompressionLevel optional
Compression level used when CompressionType is enabled.
Possible values: Optimal, Fastest, NoCompression, SmallestSize
-CompressionType CsvCompressionType optional
Compression used when writing the CSV file.
Possible values: Auto, GZip, Deflate, Brotli, ZLib
-Culture CultureInfo optional
Culture used for value formatting.
-DateTimeFormat String optional
Date/time format used for DateTime and DateTimeOffset values.
-Delimiter Char optionalsets: InputObjectPathDelimiter, InputObjectLiteralPathDelimiter, DocumentPathDelimiter, DocumentLiteralPathDelimiter
Field delimiter character.
-DelimiterText String optionalsets: InputObjectPathDelimiter, InputObjectLiteralPathDelimiter, DocumentPathDelimiter, DocumentLiteralPathDelimiter
Field delimiter text for multi-character delimiters such as || or ::.
-Encoding Encoding optional
Encoding used when writing files.
-Force SwitchParameter optional
Allow overwriting read-only files and appending rows with missing existing columns.
-FormulaInjectionPolicy CsvFormulaInjectionPolicy optional
Controls how formula-like values are written.
Possible values: Preserve, Escape
-InputObject Object optionalpipeline: True (ByValue)sets: InputObjectPathDelimiter, InputObjectPathCulture, InputObjectLiteralPathDelimiter, InputObjectLiteralPathCulture
Objects to export into CSV rows.
-MaxCollectionItems Int32 optionalsets: InputObjectPathDelimiter, InputObjectPathCulture, InputObjectLiteralPathDelimiter, InputObjectLiteralPathCulture
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 optionalsets: InputObjectPathDelimiter, InputObjectPathCulture, InputObjectLiteralPathDelimiter, InputObjectLiteralPathCulture
Maximum nesting depth allowed while normalizing one field value. Defaults to 64; increase explicitly for trusted deeper values.
-NewLine String optional
Override the newline sequence.
-NoClobber SwitchParameter optionalaliases: NoOverwrite
Do not overwrite an existing CSV file.
-NoHeader SwitchParameter optional
Omit the header row from the output.
-NullValue String optional
Token written for null values.
-PassThru SwitchParameter optional
Emit a FileInfo for the exported file.
-Path String requiredposition: 0aliases: FilePath, OutPath, OutputPathsets: InputObjectPathDelimiter, InputObjectPathCulture, DocumentPathDelimiter, DocumentPathCulture
Destination CSV path.
-QuoteFields String[] optional
Field names that should always be quoted when UseQuotes is AsNeeded.
-UseQuotes CsvQuoteMode optional
Controls when CSV fields are quoted. Defaults to quoting only fields that need it.
Possible values: AsNeeded, Always, Never
-UseUtc SwitchParameter optional
Convert date/time values to UTC before formatting.
-UseCulture SwitchParameter requiredsets: InputObjectPathCulture, InputObjectLiteralPathCulture, DocumentPathCulture, DocumentLiteralPathCulture
Use the list separator from the selected or current culture as the delimiter.
-LiteralPath String requiredaliases: LP, PSPathsets: InputObjectLiteralPathDelimiter, InputObjectLiteralPathCulture, DocumentLiteralPathDelimiter, DocumentLiteralPathCulture
Literal destination CSV path. Wildcards are not expanded.
-Document CsvDocument requiredpipeline: True (ByValue)sets: DocumentPathDelimiter, DocumentPathCulture, DocumentLiteralPathDelimiter, DocumentLiteralPathCulture
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.