PowerShell Logo Small

Export-Csv



This is the built-in help made by Microsoft for the command 'Export-Csv', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Converts Microsoft .NET Framework objects into a series of comma-separated value (CSV) variable-length strings and saves the strings in a CSV file.

SYNTAX


Export-CSV [[-Delimiter] <char>] [-Path] <string> -InputObject <psobject> [-Encoding <string>] [-Force] [-NoClobber] [-NoTypeInformation] [-Confi
rm] [-WhatIf] [<CommonParameters>]
Export-CSV [-UseCulture] [-Path] <string> -InputObject <psobject> [-Encoding <string>] [-Force] [-NoClobber] [-NoTypeInformation] [-Confirm] [-Wh
atIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Export-CSV cmdlet creates a CSV variable-length file that represents the objects that you submit.
You can then use the Import-CSV cmdlet to re-create objects from the CSV strings in the files. The resulting objects are CSV versions of the orig
inal objects that consist of string representations of the property values and no methods.

You can also use the ConvertTo-CSV and ConvertFrom-CSV cmdlets to convert .NET Framework objects to CSV strings (and back). Export-CSV is the sam
e as ConvertTo-CSV, except that it saves the CSV strings in a file.

You can use the parameters of the Export-CSV cmdlet to specify a delimiter other than a comma or to direct Export-CSV to use the default delimite
r for the current culture.

When you submit multiple objects to Export-CSV, Export-CSV organizes the file based on the properties of the first object that you submit. If the
remaining objects do not have one of the specified properties, the property value of that object is null, as represented by two consecutive comm
as. If the remaining objects have additional properties, those property values are not included in the file.

For more information, see Export-CSV, and see the Notes section.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=113299
Import-CSV
ConvertTo-CSV
ConvertFrom-CSV

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>get-process wmiprvse | select-object basePriority,ID,SessionID,WorkingSet | export-csv -path data.csv



Description
-----------
This command selects a few properties of the wmiprvse process and exports them to a CSV format file named data.csv.








-------------------------- EXAMPLE 2 --------------------------

C:\PS>get-process | export-csv processes.csv

C:\PS> get-process | export-csv processes.csv

# In processes.csv

#TYPE System.Diagnostics.Process
__NounName,Name,Handles,VM,WS,PM,NPM,Path,Company,CPU,FileVersion,...
Process,powershell,626,201666560,76058624,61943808,11960,C:\WINDOWS...
Process,powershell,257,151920640,38322176,37052416,7836,C:\WINDOWS\...



Description
-----------
This command exports objects representing the processes on the computer to the Processes.csv file in the current directory. Because it does not s
pecify a delimiter, a comma (,) is used to separate the fields in the file.








-------------------------- EXAMPLE 3 --------------------------

C:\PS>get-process | export-csv processes.csv -Delimiter ";"

# In processes.csv

#TYPE System.Diagnostics.Process
__NounName;Name;Handles;VM;WS;PM;NPM;Path;Company;CPU;FileVersion;...
Process;powershell;626;201666560;76058624;61943808;11960;C:\WINDOWS...
Process;powershell;257;151920640;38322176;37052416;7836;C:\WINDOWS\...



Description
-----------
This command exports objects representing the processes on the computer to the Processes.csv file in the current directory. It uses the Delimiter
parameter to specify the semicolon (;). As a result, the fields in the file are separated by semicolons.








-------------------------- EXAMPLE 4 --------------------------

C:\PS>get-process | export-csv processes.csv -UseCulture



Description
-----------
This command exports objects representing the processes on the computer to the Processes.csv file in the current directory. It uses the UseCultur
e parameter to direct Export-CSV to use the delimiter specified by the ListSeparator property of the current culture.








-------------------------- EXAMPLE 5 --------------------------

C:\PS>get-process | export-csv processes.csv -NoTypeInformation

C:\PS> get-process | export-csv processes.csv -NoTypeInformation

# In processes.csv

__NounName,Name,Handles,VM,WS,PM,NPM,Path,Company,CPU,FileVersion,...
Process,powershell,626,201666560,76058624,61943808,11960,C:\WINDOWS...
Process,powershell,257,151920640,38322176,37052416,7836,C:\WINDOWS\...



Description
-----------
This command exports objects representing the processes on the computer to the Processes.csv file in the current directory. It uses the NoTypeInf
ormation parameter to suppress the type information in the file.