transpose excel copied data

Welcome Forums General PowerShell Q&A transpose excel copied data

  • This topic has 1 reply, 2 voices, and was last updated 1 year ago by
    Senior Moderator
Viewing 1 reply thread
  • Author
    • #174751
      Topics: 1
      Replies: 0
      Points: 12
      Rank: Member


      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}

    • #174805
      Senior Moderator
      Topics: 9
      Replies: 1309
      Points: 4,783
      Helping Hand
      Rank: Community Hero

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

Viewing 1 reply thread
  • The topic ‘transpose excel copied data’ is closed to new replies.