transpose excel copied data


I use this code to copy, paste data from excel to export in a csv file.

The probleme i have is the data I copy is a range of cells in one line.

So when I paste and export to a csv, the result in the csv is one one line

Here is what I have in the csv:

user1, user2, user3, user4

But I would like to have:






here is the code I use.

thanks for Your help



$Excel = New-Object -comobject Excel.Application
$Excel.Visible = $False

$Workbook = $Excel.Workbooks.Open($ExcelFileName)
$WorkSheet = $WorkBook.Worksheets.Item(1)
$Range2 = $WorkSheet.Range($Range_GG)
$Worksheet = $Workbook.Worksheets.item(2)
$Range2 = $Worksheet.Range($Range_GG)
Get-Content -Path “$CSVfilename2” | Out-File -FilePath “$CSVUnifilename2” -Encoding Unicode
If(ps excel){kill -name excel}

you should definitely checkout ImportExcel module. I believe It can help you here.