# Highlight cells of specific text in html file using Powershell

**URL:** <https://forums.powershell.org/t/highlight-cells-of-specific-text-in-html-file-using-powershell/17971>\
**Category:** PowerShell Help\
**Created:** [November 16, 2021, 6:39pm UTC](https://forums.powershell.org/t/highlight-cells-of-specific-text-in-html-file-using-powershell/17971 "2021-11-16T18:39:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul20](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@Rahul20](https://forums.powershell.org/u/Rahul20)\
**Post date:** [November 16, 2021, 6:39pm UTC](https://forums.powershell.org/t/highlight-cells-of-specific-text-in-html-file-using-powershell/17971/1 "2021-11-16T18:39:34Z")

</div>

I have a html file with a table in it and I was trying to change the color of the cell based on the cell value like available or unavailable.

Below is the code

```auto
<!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>
<style>
h1, h5, th { text-align: center; font-family: Segoe UI; }
table { margin: auto; font-family: Segoe UI; box-shadow: 10px 10px 5px #888; border: thin ridge grey; }
th { background: #0046c3; color: #fff; max-width: 400px; padding: 5px 10px; }
td { font-size: 11px; padding: 5px 20px; color: #000; }
tr { background: #b8d1f3; }
tr:nth-child(even) { background: #dae5f4; }
tr:nth-child(odd) { background: #b8d1f3; }
</style> 
</head><body>
<table>
<colgroup><col/><col/></colgroup>
<tr><th>Server</th><th>Status</th></tr>
<tr><td>Server1</td><td>Available</td></tr>
<tr><td>Server2</td><td>Unable to Connect</td></tr>
</table>
</body></html>

```

can someone help me change the background color of Status column based on it’s value

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [November 16, 2021, 7:15pm UTC](https://forums.powershell.org/t/highlight-cells-of-specific-text-in-html-file-using-powershell/17971/2 "2021-11-16T19:15:11Z")

</div>

Since you do not share any code it seems like you did not make an own attempt to get this task done by yourself in the first place.

Here you can get some general help:

> **[EnhancedHTML2 2.0](https://www.powershellgallery.com/packages/EnhancedHTML2/2.0)**
>
> EnhancedHTML2 module from free ebook Creating HTML Reports in PowerShell

> **[Introduction - 《Creating Html Reports in Powershell》 - 书栈网 · BookStack](https://www.bookstack.cn/read/creating-html-reports-in-powershell/manuscript-introduction.md)**
>
> Creating HTML Reports in PowerShell Learn to properly use ConvertTo-HTML to produce multi-section, well-formed HTML reports – but then go further with a custom EnhancedHTML module! Produce beautiful,

> **[How To Create An HTML Report With PowerShell](https://adamtheautomator.com/html-report/)**
>
> Learn how to use the PowerShell ConvertTo-HTML cmdlet and CSS to create a beautiful HTML report with PowerShell that makes the report easier to understand.

[![](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/8/81699154b59380e201f9816e982cc1c197ee97ad.jpeg "Advanced HTML Report with Powershell") ](https://www.youtube.com/watch?v=y3aLzYNiee0)

---

<div class="post-metadata">

**Author:** ![matt-bloomfield](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@matt-bloomfield](https://forums.powershell.org/u/matt-bloomfield)\
**Post date:** [November 16, 2021, 9:23pm UTC](https://forums.powershell.org/t/highlight-cells-of-specific-text-in-html-file-using-powershell/17971/3 "2021-11-16T21:23:39Z")

</div>

I gave an example of how to do this in a previous thread. Take a look here:  
[ConvertTo-HTML Conditional Formatting](https://forums.powershell.org/t/convertto-html-conditional-formatting/)

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:20pm UTC](https://forums.powershell.org/t/highlight-cells-of-specific-text-in-html-file-using-powershell/17971/4 "2024-05-16T20:20:27Z")

</div>

Closed on May 16, 2024, 8:20pm UTC


