# Help needed to create a tables in Powershell

**URL:** <https://forums.powershell.org/t/help-needed-to-create-a-tables-in-powershell/20173>\
**Category:** PowerShell Help\
**Created:** [August 15, 2022, 10:08pm UTC](https://forums.powershell.org/t/help-needed-to-create-a-tables-in-powershell/20173 "2022-08-15T22:08:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Max\_Patel](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@Max\_Patel](https://forums.powershell.org/u/Max_Patel)\
**Post date:** [August 15, 2022, 10:08pm UTC](https://forums.powershell.org/t/help-needed-to-create-a-tables-in-powershell/20173/1 "2022-08-15T22:08:17Z")

</div>

Can someone guide me where to start creating table format to be included in the body of the email in HTML format to look something like this with an company logo in top left?

I was able to get it to work using an HTML file and using Get-Content in the Powershell. but due to security reason the start and end time values show up blank in the email because it blocks javascript.

 ![QA-maint-table-powershell](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/4/434836628a7fff5665c80ff64cbb7f80bdd96be3.png)

---

<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:** [August 15, 2022, 10:15pm UTC](https://forums.powershell.org/t/help-needed-to-create-a-tables-in-powershell/20173/2 "2022-08-15T22:15:12Z")

</div>

Max,  
Welcome to the forum. 👋🏽

I googled “_powershell html reports_” for you and this are the first 3 hits:

> **[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.

> **[Easy on the eyes: Creating HTML reports using PowerShell](https://techgenix.com/html-reports/)**
>
> Comma Separated Value (CSV) reports you can open in Excel are so old school. Why not use PowerShell to create HTML reports you can view in a web browser?

> **[How to generate an HTML report using PowerShell?](https://www.tutorialspoint.com/how-to-generate-an-html-report-using-powershell)**
>
> How to generate an HTML report using PowerShell? - To generate an HTML report using PowerShell, we can use the ConvertTo-HTML command. For example, let say we n ...

😏

---

<div class="post-metadata">

**Author:** ![Max\_Patel](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@Max\_Patel](https://forums.powershell.org/u/Max_Patel)\
**Post date:** [August 15, 2022, 10:24pm UTC](https://forums.powershell.org/t/help-needed-to-create-a-tables-in-powershell/20173/3 "2022-08-15T22:24:41Z")

</div>

Is there a way to add the following HTML code in a Powershell script?

```auto

<style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
  overflow:hidden;padding:10px 5px;word-break:normal;}
.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
  font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
.tg .tg-0pky{border-color:inherit;text-align:left;vertical-align:top}
</style>
<table class="tg">
<thead>
  <tr>
    <th class="tg-0pky"><span style="font-weight:bold;color:#000">Impact:</span></th>
    <th class="tg-0pky"><span style="background-color:transparent">The application and servers will be unavailable during the maintenance windows for:</span><br><br>QA</th>
  </tr>
</thead>
<tbody>
  <tr>
    <td class="tg-0pky"><span style="font-weight:bold">Environment:</span></td>
    <td class="tg-0pky"><span style="background-color:transparent">Non-Production</span></td>
  </tr>
  <tr>
    <td class="tg-0pky"><span style="font-weight:bold">Scheduled Start Time:</span></td>
    <td class="tg-0pky"><span style="background-color:transparent">08/15/2022 12:00 AM CT</span></td>
  </tr>
  <tr>
    <td class="tg-0pky"><span style="font-weight:bold">Scheduled End Time:</span></td>
    <td class="tg-0pky"><span style="background-color:transparent">08/15/2022 02:00 AM CT</span></td>
  </tr>
  <tr>
    <td class="tg-0pky"><span style="font-weight:bold">Region:</span></td>
    <td class="tg-0pky"><span style="background-color:transparent">All</span></td>
  </tr>
  <tr>
    <td class="tg-0pky"><span style="font-weight:bold">Contact:</span></td>
    <td class="tg-0pky"><span style="background-color:transparent">If you have questions or concerns in advance of this maintenance, please contact email address. </span></td>
  </tr>
</tbody>
</table>

```

---

<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:** [August 15, 2022, 10:58pm UTC](https://forums.powershell.org/t/help-needed-to-create-a-tables-in-powershell/20173/4 "2022-08-15T22:58:56Z")

</div>

> [@Max\_Patel](#):
>
> add the following HTML code in a Powershell script?

What exactly do you mean with “_adding_” HTML code in a PowerShell script? You could save it as a template in a file and read that file from a PowerShell script.

Please keep in mind - we cannot see your screen and we cannot read your mind. If you need help with a particular piece of code you wrote you should share this code here. So we might be able to help you further.

---

<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:16pm UTC](https://forums.powershell.org/t/help-needed-to-create-a-tables-in-powershell/20173/5 "2024-05-16T20:16:47Z")

</div>

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


