Conversion from Excel to HTML can be done by combination of Import-Excel from PowerShell module ImportExcel and ConvertTo-Html cmdlet. Lets use Excel file generated in previous post. Conversion is done by one-liner:
Import-Excel .\Services.xlsx | ConvertTo-Html
Output is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>HTML TABLE</title> </head><body> <table> <colgroup><col/><col/><col/></colgroup> <tr><th>Name</th><th>Status</th><th>StartType</th></tr> <tr><td>AarSvc_dc323</td><td>Running</td><td>Manual</td></tr> <tr><td>AdobeARMservice</td><td>Running</td><td>Automatic</td></tr> <tr><td>AESMService</td><td>Running</td><td>Automatic</td></tr> <tr><td>AJRouter</td><td>Stopped</td><td>Manual</td></tr> <tr><td>ALG</td><td>Stopped</td><td>Manual</td></tr> <tr><td>AMD Crash Defender Service</td><td>Running</td><td>Automatic</td></tr> <tr><td>AMD External Events Utility</td><td>Running</td><td>Automatic</td></tr> <tr><td>AppHostSvc</td><td>Running</td><td>Automatic</td></tr> <tr><td>AppIDSvc</td><td>Stopped</td><td>Manual</td></tr> <tr><td>Appinfo</td><td>Running</td><td>Manual</td></tr> </table> </body></html>
If we want to save HTML directly into file, Out-File cmdlet is added:
Import-Excel .\Services.xlsx | ConvertTo-Html | Out-File Services.html -Encoding utf8