19 January,2012 by Tom Collins
SQL Server, Powershell and Excel are a good mix . But saving to Powershell output to HTML is versatile – if requiring email attachments or publishing results to a web page .
Any Powershell scripts using Excel as an end point can be converted to HTML with just a few lines of code. Therefore you can keep the Powershell \ Excel code , and add some lines for HTML output.
The convert process , creates well formatted HTML pages , ideal for reports. Creating the reports in HTML makes them easier to read on my smartphone – which does a better job at web browsing rather than reading Excel
$xlHtml = 44 $omit = [type]::Missing $Excel = New-Object -ComObject Excel.Application --some activity e.g recordsets --would normally save Excel as : --$EXcel.ActiveWorkbook.SaveAs("c:myfile.xls") --instead save the workbook as html $EXcel.ActiveWorkbook.SaveAs("c:myfile.html",$xlHtml,$omit,$omit,$omit,$omit,$omit,$omit,$omit,$omit,$omit,$omit) $Excel.Quit()
Powershell , Excel charts and data presentation
Powershell sql server security audit
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |