I have an excel file of new-hires for the company. Firstly I need to hide all the columns that will be used for searching users. That was pretty simple and I managed to do it. Now I'm left only with the columns I really need.
Now is the real problem:
I need to filter the data and then import those usernames to the PowerShell array.
So in excel it looks like this:

Then I have the function:
Function GetUsernames ($WorkSheet) {
$userName = $WorkSheet.UsedRange.Rows.Columns["UserNameColumn"].Value2
return $userName
}
But it's returning all of the records in the Username column - 651 records instead of 476.
The function is waiting for my input after I format the excel file manually.
Any directions will be appreciated! :)