CSV - Delete Row

Hi Guys.

I have a CSV file and lets say it has Columns A and B

Within the CSV typically Columns A and B will contain data but we have a situation where there might be no data in Columns A but there is in B. In this case we would want to delete the rows where there are no data in A.

This should then leave A and B with data.


You forgot to ask a question. :point_up_2:t4: :wink:

If the question is how to filter rows with empty cells - you simply use loop with an if condition inside.

Sorry. I thought i had asked a question.

I am looking to delete all rows where there is no data in Column A.

That is still no closer to being an actual question. We can help but we can’t read your mind or see your screen (code you need help with)

What do you mean with "I am looking … "

Please keep in mind: This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.

What have you tried so far? We expect you to make an own attempt to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.

I wasn’t asking anyone to write a script just some pointers. Anyway I have achieved it a different way when exporting the CSV file.
where {![string]::IsNullOrWhiteSpace( $_.UserName)}

Select UserName, OneDriveSiteUrl | where {![string]::IsNullOrWhiteSpace( $_.UserName)}

I gave you a pointer in my first answer. :smirk:

Great. :+1:t4:

Anyway: When you post code, sample data, console output or error messages, please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Thanks in advance