Project

PSWriteHTML

Generate HTML reports, dashboards, and emails from PowerShell without writing HTML, CSS, or JavaScript.

Stars 1,019
Forks 115
Open issues 54
PowerShell Gallery downloads 7,576,901
Release v1.41.0
Language: PowerShell Updated: 2026-10-03
Command

New-HTMLTable

Module PSWriteHTML

Creates a new HTML table with various customization options.

Syntax

New-HTMLTable [-AllProperties] [-AlphabetSearch] [-AutoSize] [-Buttons <String[]>] [-Compare] [-CompareNames <Array>] [-CompareReplace <Array>] [-DataStore <HTML|JavaScript|AjaxJSON>] [-DataStoreID <String>] [-DataTable <Array>] [-DataTableID <String>] [-DateTimeSortingFormat <String[]>] [-DefaultSortColumn <String[]>] [-DefaultSortIndex <Int32[]>] [-DefaultSortOrder <Ascending|Descending>] [-DisableAutoWidthOptimization] [-DisableInfo] [-DisableNewLine] [-DisableOrdering] [-DisablePaging] [-DisableProcessing] [-DisableResponsiveTable] [-DisableSearch] [-DisableSelect] [-DisableStateSave] [-EnableAutoFill] [-EnableColumnReorder] [-EnableKeys] [-EnableRowReorder] [-EnableScroller] [-ExcludeProperty <String[]>] [-Filtering] [-FilteringLocation <Top|Bottom|Both>] [-Find <String>] [-First <Int32>] [-FixedFooter] [-FixedHeader] [-FlattenDepth <Int32>] [-FlattenObject] [-FreezeColumnsLeft <Int32>] [-FreezeColumnsRight <Int32>] [-FuzzySearch] [-FuzzySearchSmartToggle] [-HideButtons] [-HideFooter] [-HideShowButton] [-HighlightDifferences] [[-HTML] <ScriptBlock>] [-ImmediatelyShowHiddenDetails] [-IncludeProperty <String[]>] [-InvokeHTMLTags] [-Last <Int32>] [-OrderMulti] [-OverwriteDOM <String>] [-PagingLength <Int32>] [-PagingOptions <Int32[]>] [-PagingStyle <String[]>] [[-PostContent] <ScriptBlock>] [[-PreContent] <ScriptBlock>] [-PrettifyObject] [-PrettifyObjectDateTimeFormat <String>] [-PrettifyObjectSeparator <String>] [-PriorityProperties <String[]>] [-ResponsivePriorityOrder <String[]>] [-ResponsivePriorityOrderIndex <Int32[]>] [-ScreenSizePercent <Int32>] [-ScrollCollapse] [-ScrollSizeY <Int32>] [-ScrollX] [-ScrollY] [-SearchBuilder] [-SearchBuilderLocation <top|bottom>] [-SearchHighlight] [-SearchPane] [-SearchPaneLocation <top|bottom>] [-SearchRegularExpression] [-Simplify] [-SkipProperties] [-Style <String[]>] [-TextWhenNoData <String>] [-Title <String>] [-Transpose] [-TransposeLegacy] [-TransposeName <String>] [-TransposeProperty <String>] [-Width <Object>] [-WordBreak <normal|break-all|keep-all|break-word>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

This function generates an HTML table based on the provided data and allows for extensive customization using a wide range of parameters.

Examples

Authored help example

EXAMPLE 1

$data = @(
    [PSCustomObject]@{ Name = 'John'; Age = 30 },
    [PSCustomObject]@{ Name = 'Jane'; Age = 25 }
)
New-HTMLTable -DataTable $data -Title 'User Information' -Buttons @('copyHtml5', 'excelHtml5') -PagingStyle 'full_numbers' -PagingOptions @(10, 25, 50) -DefaultSortColumn @('Name') -DefaultSortOrder @('Ascending')

Parameters

-AllProperties SwitchParameter optional
Displays all properties in the table.
-AlphabetSearch SwitchParameter optional
Enables alphabet search.
-AutoSize SwitchParameter optional
Automatically sizes the table.
-Buttons String[] optional
An array of buttons to be displayed in the table for actions like copying, exporting, and printing.
Possible values: copyHtml5, excelHtml5, csvHtml5, pdfHtml5, pageLength, print, searchPanes, searchBuilder, columnVisibility, toggleView
-Compare SwitchParameter optional
Compares data in the table.
-CompareNames Array optional
Names to compare in the table.
-CompareReplace Array optionalaliases: Replace
Replaces data for comparison.
-DataStore String optional
Stores data for the table.
Possible values: HTML, JavaScript, AjaxJSON
-DataStoreID String optional
The ID of the data store.
-DataTable Array optionalaliases: ArrayOfObjects, Object, Table
An array of objects containing the data to be displayed in the table.
-DataTableID String optionalaliases: DataTableName
The ID of the data table.
-DateTimeSortingFormat String[] optional
An array of date-time formats for sorting.
-DefaultSortColumn String[] optional
An array of default columns to sort by.
-DefaultSortIndex Int32[] optional
An array of default column indexes to sort by.
-DefaultSortOrder String[] optional
The default sort order (Ascending, Descending).
Possible values: Ascending, Descending
-DisableAutoWidthOptimization SwitchParameter optional
Disables auto width optimization.
-DisableInfo SwitchParameter optional
Disables information display at the bottom of the table.
-DisableNewLine SwitchParameter optional
Disables new line characters in the table.
-DisableOrdering SwitchParameter optional
Disables column ordering in the table.
-DisablePaging SwitchParameter optional
Disables pagination in the table.
-DisableProcessing SwitchParameter optional
Disables processing indicator in the table.
-DisableResponsiveTable SwitchParameter optional
Disables responsiveness of the table.
-DisableSearch SwitchParameter optional
Disables search functionality in the table.
-DisableSelect SwitchParameter optional
Disables row selection in the table.
-DisableStateSave SwitchParameter optional
Disables saving the state of the table.
-EnableAutoFill SwitchParameter optional
Enables auto-filling in the table.
-EnableColumnReorder SwitchParameter optional
Enables column reordering in the table.
-EnableKeys SwitchParameter optional
Enables keyboard navigation in the table.
-EnableRowReorder SwitchParameter optional
Enables row reordering in the table.
-EnableScroller SwitchParameter optional
Enables table scrolling.
-ExcludeProperty String[] optional
Properties to exclude from the table.
-Filtering SwitchParameter optional
Enables filtering in the table.
-FilteringLocation String optional
Specifies the location of the filter (Top, Bottom, Both).
Possible values: Top, Bottom, Both
-Find String optionalaliases: Search
Search string to find in the table.
-First Int32 optional
Displays the first item in the table.
-FixedFooter SwitchParameter optional
Fixes the footer of the table.
-FixedHeader SwitchParameter optional
Fixes the header of the table.
-FlattenDepth Int32 optional
The depth to flatten the object.
-FlattenObject SwitchParameter optional
Flattens the object for display.
-FreezeColumnsLeft Int32 optional
The number of columns to freeze on the left.
-FreezeColumnsRight Int32 optional
The number of columns to freeze on the right.
-FuzzySearch SwitchParameter optional
Enables fuzzy search.
-FuzzySearchSmartToggle SwitchParameter optional
Toggles smart fuzzy search.
-HideButtons SwitchParameter optionalaliases: DisableButtons
Hides all buttons in the table.
-HideFooter SwitchParameter optional
Hides the footer of the table.
-HideShowButton SwitchParameter optionalaliases: RemoveShowButton
Displays a button to show/hide details.
-HighlightDifferences SwitchParameter optionalaliases: CompareWithColors
Highlights differences in the table.
-HTML ScriptBlock optionalposition: 0
The HTML content to be included before the table.
-ImmediatelyShowHiddenDetails SwitchParameter optional
Shows hidden details immediately.
-IncludeProperty String[] optional
Properties to include in the table.
-InvokeHTMLTags SwitchParameter optional
Enables HTML tags in the table.
-Last Int32 optional
Displays the last item in the table.
-OrderMulti SwitchParameter optional
Allows multiple column ordering in the table.
-OverwriteDOM String optional
Overwrites the DOM structure.
-PagingLength Int32 optional
The default number of items to display per page.
-PagingOptions Int32[] optional
An array of options for the number of items to display per page.
-PagingStyle String[] optional
The style of pagination to be used in the table.
Possible values: numbers, simple, simple_numbers, full, full_numbers, first_last_numbers
-PostContent ScriptBlock optionalposition: 2
Additional content to be included after the table.
-PreContent ScriptBlock optionalposition: 1
Additional content to be included before the table.
-PrettifyObject SwitchParameter optional
Forces object to be preprocessed before passing to HTML. This is useful when converting object with arrays or when there is a need to display DateTime in different format. This is mostly useful for email tables or when using DataStore HTML.
-PrettifyObjectDateTimeFormat String optional
DateTime format for prettified object.
-PrettifyObjectSeparator String optional
Define separator for prettified array object. Default is ", ".
-PriorityProperties String[] optional
Properties to prioritize in the table.
-ResponsivePriorityOrder String[] optional
The priority order for responsiveness.
-ResponsivePriorityOrderIndex Int32[] optional
The index for responsive priority order.
-ScreenSizePercent Int32 optional
The percentage of the screen width to occupy.
-ScrollCollapse SwitchParameter optional
Collapses the table when scrolling.
-ScrollSizeY Int32 optional
The height of the vertical scroll.
-ScrollX SwitchParameter optional
Enables horizontal scrolling.
-ScrollY SwitchParameter optional
Enables vertical scrolling.
-SearchBuilder SwitchParameter optional
Enables search builder in the table.
-SearchBuilderLocation String optional
Specifies the location of the search builder.
Possible values: top, bottom
-SearchHighlight SwitchParameter optional
Highlights search results.
-SearchPane SwitchParameter optional
Enables search pane in the table.
-SearchPaneLocation String optional
Specifies the location of the search pane.
Possible values: top, bottom
-SearchRegularExpression SwitchParameter optionalaliases: RegularExpression
Enables regular expression search.
-Simplify SwitchParameter optional
Simplifies the table layout.
-SkipProperties SwitchParameter optional
Properties to skip in the table.
-Style String[] optional
An array of styles to apply to the table.
Possible values: display, cell-border, compact, hover, nowrap, order-column, row-border, stripe
-TextWhenNoData String optional
The text to display when no data is available.
-Title String optional
The title of the HTML table.
-Transpose SwitchParameter optional
Transpose table. This is useful when you have objects and you want to transpose them.
-TransposeLegacy SwitchParameter optional
Use old method of transposing table. This is useful when you have objects and you want to transpose them, using legacy method.
-TransposeName String optional
Name of the column that will be used per object to transpose table. By default it's "Object X", "Object Y", "Object Z" etc.
-TransposeProperty String optional
Transpose table based on property. By default it's "Object X". This makes sense if you have unique value per object that you want to transpose table based on.
-Width Object optional
-WordBreak String optional
Enables word breaking in the table.
Possible values: normal, break-all, keep-all, break-word

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.