title: Powershell: Open HTM and Save As XLS
body: <p>is it possible to have Powershell open a .HTM and save as an .XLS. My HTM file is a table that I would like the formatting carried though to which rules out a CSV. I have tried various methods using save as however it just saves the file with the .XLS extension whilst still being an .HTM file. I believe I just need the middle part of the script below filled in with the Save As code. Any assistance would be greatly appreciated.</p>
  
  <pre><code>$Excel = New-Object -comobject Excel.Application
  $FilePath = "C:\ScriptRepository\Results\Test.htm"
  $Workbook = $Excel.Workbooks.Open($FilePath)
  $Excel.Visible = $true
  $Excel.DisplayAlerts = $False
  
  $Excel.Workbooks.Close()
  $Excel.Quit()
  [System.GC]::Collect()
  [System.GC]::WaitForPendingFinalizers()
  [System.Runtime.Interopservices.Marshal]::ReleaseComObject($WorkBook)
  [System.Runtime.Interopservices.Marshal]::ReleaseComObject($Excel)
  Remove-Variable -Name excel
  </code></pre>