Importing csv colomns with powershell gui

Hello everyone,

im trying to to import a csv file. inside a form Gui combobox. the problem im encountering is dat i want for the combobox only show the first colomn (column A) . in the future i want another combobox and have only column b imported from the same file.

with the code i have it imports all filled rows and shows everthing. i tried different possibilities like get-content and played with -header -property and -expandproperty. but none of the methods works. off course i can make for every combobox a separate csv file, but that is not something i want.

this is a part of what i see inside the combobox to select:
@{abbreviation=; firstname=; secondname=; lastname =}

$cBox2 = New-Object "System.Windows.Forms.combobox";
$cbox2.Location = New-Object System.Drawing.Point(10,120)
$cbox2.Size = New-Object System.Drawing.Size(260,20)

import-csv -Path $file -Delimiter ";" -Header "firstname" | ForEach-Object {


even tried with -select and -select-object, and tried different CSV files (with and without separated) but i cant figure it out. any help is appreciated


did something good i get the column i want inside the box but now i says @{firstname=NAME}

if anyone know the answer before i figure out how to edit that to just the ‘NAME’ it is appreciated offcourse.

Why don’t you show what you did?

If you just want a pariticular column why don’t you specify this particular column? If the column is named firstname this should do the trick:


Hi Olaf,

i edit the original code for the solution.

and i just found out what i was seraching for.

$file = "$PSScriptRoot\list.csv"
import-csv -Path $bestand -Delimiter ";"  | select -ExpandProperty firstname |  ForEach-Object {


this way it just show the ‘John’ instead of @{firstname=John}

i tried to add $_.firstname but that didnt work. probably i made a mistake somewhere else earlier in the script. but when i try that now it works. i looked on the internet i saw that suggestion multiple times. i couldnt figure out what i did wrong and i still dont know. :slight_smile:

When you already turned the object into strings with the parameter -ExpandProperty you cannot use the dot notration anymore anyway. There is no property firstname anymore then.