Issue with HTML Table Styling in Databricks Alerts

VKe
New Contributor III

Hi Community,

I’m trying to create an alert in Databricks with a custom email notification that includes the results of a SQL query displayed in an HTML table. However, I am facing issues with styling the table, specifically with adding borders and background colors to the headers.

Here is the HTML code I am currently using:

 

<table border="1" cellpadding="5" cellspacing="0">
  <tr style="background-color: black; color: white; font-weight: bold;">
    <th>Project Name</th>
    <th>Jira ID</th>
    <th>Category</th>
    <th>Site</th>
  </tr>
  <tbody>
    {{#QUERY_RESULT_ROWS}}
    <tr>
      <td>{{Project_Name}}</td>
      <td>{{Jira_ID}}</td>
      <td>{{Category_1}}</td>
      <td>{{Site}}</td>
    </tr>
    {{/QUERY_RESULT_ROWS}}
  </tbody>
</table>

 

The table renders correctly with the data, but the following issues persist:

  • Borders do not appear around the cells.
  • Background color for the header row doesn’t display.
  • Overall table styling (such as cellpadding and cellspacing) doesn’t seem to be applied.

I have tried several variations, including inline styles, but nothing seems to work. Is there a limitation with HTML and CSS in Databricks alerts, or am I missing something in the implementation?

Any guidance or solutions on how to display a properly styled table in the alert email would be greatly appreciated!

Thank you!