Import-Csv
Additional Resources for Import-Csv |
Read in a Comma-Separated Values File http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/import-csv.mspx
|
SYNOPSIS
Imports comma-separated value (CSV) files in the format produced by the Export-CSV cmdlet and returns objects that correspond to the objects represented in that CSV file.
SYNTAX
Import-Csv [-path] <string[]> [<CommonParameters>]
DETAILED DESCRIPTION
Imports comma-separated value (CSV) files in the format produced by the Export-CSV cmdlet and returns objects that correspond to the objects represented in that CSV file.
PARAMETERS
-path <string[]>
Specifies the path to the CSV file to import.
Required? |
true |
Position? |
1 |
Default value |
Null |
Accept pipeline input? |
true (ByValue, ByPropertyName) |
Accept wildcard characters? |
true |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".
INPUT TYPE
#TYPE CSV
RETURN TYPE
Objects
EXAMPLE 1
get-process | export-csv processes.csv
$processes =
import-CSV processes.csv
$processes
This command exports information about processes to a CSV file and then restores that process information. In the first line of the command, the output of the Get-Process cmdlet is piped to the Export-CSVcmdlet which saves a representation of the output objects to the file named processes.csv. In the second line, the Import-CSV cmdlet is used to retrieve the saved object representation from the processes.csv file, create corresponding objects and store them in the $processes variable.
RELATED LINKS