Read Excel sheet in Powershell

后端 未结 4 1298
有刺的猬
有刺的猬 2020-11-29 09:22

The below script reads the sheet names of an Excel document....

How could I improve it so it could extract all the contents of column B (starting from row 5 - so row

4条回答
  •  猫巷女王i
    2020-11-29 09:57

    There is the possibility of making something really more cool!

    # Powershell 
    $xl = new-object -ComObject excell.application
    $doc=$xl.workbooks.open("Filepath")
    $doc.Sheets.item(1).rows |
    % { ($_.value2 | Select-Object -first 3 | Select-Object -last 2) -join "," }
    

提交回复
热议问题