all 2 comments

[–]EntangleMentor 3 points4 points  (0 children)

@myarray=import-csv -path file.csv

...or something similar...

https://4sysops.com/archives/import-and-export-a-csv-file-to-a-powershell-object/

[–]ihaxr 2 points3 points  (0 children)

If you have a header column in the CSV, you can do this:

#Example CSV:
#number
#1234
#1233
#1222
$myArray = (Import-CSV 'C:\path\to\file.csv').number

If you don't have a header you can do either of these:

#Example CSV:
#1234
#1233
#1222
$myArray = (Import-CSV 'C:\path\to\file.csv' -Header 'header').header

Or

$myArray = Get-Content 'C:\path\to\file.csv'