PowerShell CSV parsing Basic usage of Import-Csv

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Given the following CSV-file

String,DateTime,Integer
First,2016-12-01T12:00:00,30
Second,2015-12-01T12:00:00,20
Third,2015-12-01T12:00:00,20

One can import the CSV rows in PowerShell objects using the Import-Csv command

> $listOfRows = Import-Csv .\example.csv
> $listOfRows

String DateTime            Integer
------ --------            -------
First  2016-12-01T12:00:00 30     
Second 2015-11-03T13:00:00 20     
Third  2015-12-05T14:00:00 20 

> Write-Host $row[0].String1
Third


Got any PowerShell Question?