Public/ConvertTo-HtmlTable.ps1

function ConvertTo-HtmlTable
{
    param
    (
        [object[]]$TableData,
        [string]$Heading,
        [string]$Paragraph
    )

    if ($TableData.Count -lt 1)
    {
         return ""
    }
    $tableHeaderNames = ($TableData | ConvertTo-Csv -NoTypeInformation)[0] -replace '"' -split ','
    $tableHeaders = ""
    
    foreach ($header in $tableHeaderNames)
    {
        $tableHeaders += "<th style=""padding: 10px;padding-right: 50px;padding-top: 12px;padding-bottom: 12px;text-align: left;background-color: #3565b8;color: white;"">$header</th>`r`n"
    }

    $tableRows = ""
    $counter = 2
    foreach ($row in $TableData)
    {
        if ($counter % 2 -eq 0)
        {
            $rowBg = "background-color: #f2f2f2;"
        }
        else
        {
            $rowBg = ""
        }

        $counter++
        
        $tableRows += "<tr>`r`n"
        foreach ($header in $tableHeaderNames)
        {
            $tableRows += "<td style=""padding: 10px;$rowBg"">$($row.$header)</td>`r`n"
            
        }
        $tableRows += "</tr>`r`n"

    }


$html = @"
<div class="container" style="margin-left: 20px;">
    <div class="row">
        <div class="col-md-6">
        $(if ($Heading.Length -gt 0) {"<h3 style=""font-family: Arial, Helvetica, sans-serif;"">$Heading</h3>"})
            $(if ($Paragraph.Length -gt 0) {"<p style=""font-family: Arial, Helvetica, sans-serif;"">$Paragraph</p>"})
            <table class="table table-hover table-striped" style="font-family: Arial, Helvetica, sans-serif;border-collapse: collapse;font-size: 15px;">
                <tr>
                    $tableHeaders
                </tr>

                $tableRows

            </table>

        </div>
    </div>
</div>
<br/>
<hr />
<br/>
"@


    return $html
}