API Reference
Cmdlet
Export-OfficeCsv
Exports objects or a CSV document to a CSV file.
Remarks
Use ConvertTo-OfficeCsv when the destination should be CSV text in the pipeline.
Examples
Export objects to a CSV file.
PS>
$data | Export-OfficeCsv -Path .\export.csv
Streams PowerShell objects into a CSV file.
Export with culture list separator.
PS>
$data | Export-OfficeCsv -Path .\export.csv -UseCulture -Culture pl-PL
Uses the selected culture list separator as the delimiter.
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
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>] [-NewLine <String>] [-NoClobber] [-NoHeader] [-NullValue <String>] [-PassThru] -Path <String> [-QuoteFields <String[]>] [-UseQuotes <AsNeeded|Always|Never>] [-UseUtc] [<CommonParameters>]#Parameter set:
InputObjectPathDelimiterParameters
- 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.
- 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.
Outputs
System.IO.FileInfo
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>] [-NewLine <String>] [-NoClobber] [-NoHeader] [-NullValue <String>] [-PassThru] -Path <String> [-QuoteFields <String[]>] -UseCulture [-UseQuotes <AsNeeded|Always|Never>] [-UseUtc] [<CommonParameters>]#Parameter set:
InputObjectPathCultureParameters
- 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.
- 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.
- 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.
- UseCulture SwitchParameter
- Use the list separator from the selected or current culture as the delimiter.
- 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.
Outputs
System.IO.FileInfo
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> [-NewLine <String>] [-NoClobber] [-NoHeader] [-NullValue <String>] [-PassThru] [-QuoteFields <String[]>] [-UseQuotes <AsNeeded|Always|Never>] [-UseUtc] [<CommonParameters>]#Parameter set:
InputObjectLiteralPathDelimiterParameters
- 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.
- LiteralPath String
- Literal destination CSV path. Wildcards are not expanded.
- 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.
- 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.
Outputs
System.IO.FileInfo
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> [-NewLine <String>] [-NoClobber] [-NoHeader] [-NullValue <String>] [-PassThru] [-QuoteFields <String[]>] -UseCulture [-UseQuotes <AsNeeded|Always|Never>] [-UseUtc] [<CommonParameters>]#Parameter set:
InputObjectLiteralPathCultureParameters
- 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.
- 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.
- LiteralPath String
- Literal destination CSV path. Wildcards are not expanded.
- 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.
- QuoteFields String[]
- Field names that should always be quoted when UseQuotes is AsNeeded.
- UseCulture SwitchParameter
- Use the list separator from the selected or current culture as the delimiter.
- 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.
Outputs
System.IO.FileInfo
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:
DocumentPathDelimiterParameters
- 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 ::.
- Document CsvDocument
- CSV document to export.
- 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 - 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.
Outputs
System.IO.FileInfo
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:
DocumentPathCultureParameters
- 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.
- Document CsvDocument
- CSV document to export.
- 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 - 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.
- UseCulture SwitchParameter
- Use the list separator from the selected or current culture as the delimiter.
- 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.
Outputs
System.IO.FileInfo
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:
DocumentLiteralPathDelimiterParameters
- 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 ::.
- Document CsvDocument
- CSV document to export.
- 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 - LiteralPath String
- Literal destination CSV path. Wildcards are not expanded.
- 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.
- 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.
Outputs
System.IO.FileInfo
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:
DocumentLiteralPathCultureParameters
- 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.
- Document CsvDocument
- CSV document to export.
- 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 - LiteralPath String
- Literal destination CSV path. Wildcards are not expanded.
- 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.
- QuoteFields String[]
- Field names that should always be quoted when UseQuotes is AsNeeded.
- UseCulture SwitchParameter
- Use the list separator from the selected or current culture as the delimiter.
- 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.
Outputs
System.IO.FileInfo