Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

export-csv not working as I expect

$
0
0

I have the following code that I thought was going to write the values of the array of arrays or the array but in both cases, the results I'm getting are confusing to me (results look like attributes of the array).  Conceptually I am doing something wrong and I'm looking for help in getting my array of arrays exported as a single .csv file.


$row1 = "abcd", "cdef"
$row2 = "ghij", "klmn"
$row3 = "opqr", "stuv"
$jagged = $row1, $row2, $row3
$row1  | Export-Csv "C:\Files\row.csv"
$jagged| Export-Csv "C:\Files\jagged.csv"

Here is rows.csv after I run the script

#TYPE System.String
"Length"
"4"
"4"

And here is jagged.csv after I run the script

#TYPE System.Object[]
"Count","Length","LongLength","Rank","SyncRoot","IsReadOnly","IsFixedSize","IsSynchronized"
"2","2","2","1","System.Object[]","False","True","False"
"2","2","2","1","System.Object[]","False","True","False"
"2","2","2","1","System.Object[]","False","True","False"

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles