# New-TableColumnOption

Allows for certain modification of options within DataTable's columnDefs parameter.

Project

PSWriteHTML

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

[View on GitHub](https://github.com/EvotecIT/PSWriteHTML) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteHTML/releases/tag/v1.41.0) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteHTML/1.40.0)

Stars **1,025**

Forks **114**

Open issues 

PowerShell Gallery downloads **7,576,901**

Release **v1.45.0**

Language: PowerShell Updated: 2026-11-19

Command 

**Module**

`PSWriteHTML`

**Inputs**

`None. You cannot pipe objects to New-TableColumnOption`

**Outputs**

`PSCustomObject`

Allows for certain modification of options within DataTable's columnDefs parameter. You can set visibility, searchability, sortability, and width for specific columns

## Syntax

```
New-TableColumnOption
-ColumnIndex <Int32[]>
[-Hidden <Boolean>]
[-Searchable <Boolean>]
[-Sortable <Boolean>]
[-Width <String>]
[<CommonParameters>]
```

[#](#method-new-tablecolumnoption-int32-boolean-boolean-boolean-string)

Parameter set: `ColumnIndex`

```
New-TableColumnOption
-AllColumns
[-Hidden <Boolean>]
[-Searchable <Boolean>]
[-Sortable <Boolean>]
[-Width <String>]
[<CommonParameters>]
```

[#](#method-new-tablecolumnoption-switchparameter-boolean-boolean-boolean-string)

Parameter set: `AllColumns`

## Description

Allows for certain modification of options within DataTable's columnDefs parameter. See: https://datatables.net/reference/option/columnDefs

New-HTMLTable has parameters for -ResponsivePriorityOrder and -ResponsivePriorityOrderIndex and these are set at a higher precedent than options specified here. See the DataTable reference section for conflict resolution.

The New-TableColumnOption cmdlet will add entries to the columnDefs parameter in the order in which the cmdlets are ordered. If you use 2 or more New-TableColumnOption, the first cmdlet takes priority over the second cmdlet if they specify the same targets or overriding property values With this in mind, you should almost always specify -AllColumns last, since that will take priority over any commands issued later

## Examples

### Example 1

```powershell
New-TableColumnOption -ColumnIndex (0..4) -Width 50
The first 5 columns with have a width defined as 50, this may not be exact.
See: https://datatables.net/reference/option/columns.width
```

### Example 2

```powershell
New-TableColumnOption -ColumnIndex 0,1,2 -Hidden $false
New-TableColumnOption -ColumnIndex 1 -Sortable $true
New-TableColumnOption -AllColumns -Hidden $true -Searchable $false -Sortable $false
All columns will be hidden, not searchable, and not sortable
However, since there is a option specified higher up, the first 3 columns will be visible
Additionally the 2nd column will be sortable
```

## Parameters

**-ColumnIndex Int32[] requiredaliases: Targetssets: ColumnIndex**

Identifies specific columns that the properties should apply to

**-Hidden Boolean optional**

Defines if a column is hidden. A hidden column can still be used by Conditional Formatting and can still be searchable

**-Searchable Boolean optional**

Defines if a column is able to be searched

**-Sortable Boolean optional**

Defines if a column can be sorted

**-Width String optional**

Width for the column as a string

**-AllColumns SwitchParameter requiredaliases: AllTargets, TargetAllsets: AllColumns**

Uses the columnDef Target "_ALL" to indicate all columns / remaining columns

## 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:56AFAB5409CD7CF9EA84FDEECE6AD25D70B684EE57251C2571A10C1DB5E7B860 -->
