Convert XML to xlsx in powershell

后端 未结 1 1304
野趣味
野趣味 2021-01-15 20:22

I found some powershell command online to convert an xlsx file to an xml file. This works great, but the xml I am getting will be manipulated slightly, and after that I nee

1条回答
  •  情话喂你
    2021-01-15 21:17

    Just open the xml file and save it.

    The Format code for an xlsx file is 51, as per https://msdn.microsoft.com/en-us/vba/excel-vba/articles/xlfileformat-enumeration-excel

    $xlsSpreadsheet = 51
    $Excel = New-Object -Com Excel.Application
    $WorkBook = $Excel.Workbooks.Open("c:\Test.xml")
    $WorkBook.SaveAs("c:\Test.xlsx", $xlsSpreadsheet)
    $Excel.Quit()
    

    0 讨论(0)
提交回复
热议问题