Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

How to get Import-CSV to work for me

$
0
0

Hi,

I have a csv file with 5 columns, the first 3 columns are IPV4 IPs with the 4-6 columns just text.  My goal is to Import the CSV, convert to strings, then perform string comparisons using the first 3 columns against other variables.

The issue I'm seeing is an Import-Csv natively creates a PSCustomObject, so I perform the following to create the first column as a string, however this technique doesn't work for the other columns.

$header = "H1", "H2", "H3", "H4", "H5", "H6"

$Data=Import-Csv C:\Data.csv -Header $header | Select -Expand H1

I need the whole row or all columns to be string so I can use in my script for comparisons.  How can I do this?


Thanks for your help! SdeDot


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>