Basic usage of Import-Csv
suggest changeGiven 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
Import the CSV rows as PowerShell objects with Import-Csv. Every field is a string; the header names do not set the .NET type.
$listOfRows = Import-Csv .\example.csv
$listOfRows
String DateTime Integer
------ -------- -------
First 2016-12-01T12:00:00 30
Second 2015-12-01T12:00:00 20
Third 2015-12-01T12:00:00 20
Write-Host $listOfRows[0].String
First
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents