Example usage of Import-Csv.
Import-Csv .\users.csv | Select-Object -First 5Creates table-like custom objects from the items in a character-separated value (CSV) file.
Import-Csv [-Path] <string>This is a practical syntax summary, not every parameter set. Run Get-Command Import-Csv -Syntax and Get-Help Import-Csv -Full in the installed version for its complete syntax and parameter metadata. Common parameters and -WhatIf/-Confirm support depend on the command and PowerShell version.
Example usage of Import-Csv.
Import-Csv .\users.csv | Select-Object -First 5Read all available parameter sets and help for the installed module.
Get-Help Import-Csv -Full| Option / clause | Description |
|---|---|
-Path <file[]> | Select CSV input files. |
-Delimiter <char> | Set the column delimiter. |
-Header <string[]> | Supply column names instead of using the first row. |
-Encoding <name> | Set input encoding where supported. |
-Verbose | Write additional diagnostic detail to the verbose stream. |
-Debug | Write debugging messages to the debug stream. |
-ErrorAction <action> | Control how a non-terminating error is handled. |
-ErrorVariable <name> | Store error records in a variable. |
-WarningAction <action> | Control how warnings are handled. |
-WarningVariable <name> | Store warning messages in a variable. |
-InformationAction <action> | Control how information messages are handled. |
-InformationVariable <name> | Store information messages in a variable. |
-OutVariable <name> | Store output in a variable as well as sending it onward. |
-OutBuffer <count> | Set the number of objects to collect before the next command runs. |
-PipelineVariable <name> | Store the current pipeline object in a variable during processing. |
-ProgressAction <action> | Control progress reporting in versions that support this parameter. |
-WhatIf / -Confirm | Risk-control parameters available only on commands that support ShouldProcess. |
Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.