I have two related questions regarding formatting arrays of strings ($array1, $array2, $array3) into a table.
- What’s the easiest way to sort them into columns, each with their own heading? For example,
ColumnA ColumnB etc…
A A
B B
C C
I tried:
$table = @( @{ ColumnA=“$array1”; ColumnB=“$array2”; ColumnC=“$array3”})
$table.ForEach({[PSCustomObject]$_}) | Format-Table -AutoSize
But the elements form rows, not columns.
- As a second step, how would I convert this table to html with a header and borders? For example,
HEADER
ColumnA ColumnB etc…
A A
B B
C C
I’ve gotten this to work before, but the solution was a little messy, so I want to see what the cleanest way is.
Thanks for any help.