# Set-OfficeExcelColumnGroup

Groups columns into a collapsible outline, or clears grouping.

Cmdlet 

Aliases: ExcelColumnGroup

**Module**

`PSWriteOffice`

**Aliases**

`ExcelColumnGroup`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Source**

[SetOfficeExcelColumnGroupCommand.cs:37](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Excel/SetOfficeExcelColumnGroupCommand.cs#L37) 

Groups columns into a collapsible outline, or clears grouping.

## Syntax

```
Set-OfficeExcelColumnGroup
[-Clear]
[-Collapsed]
[-Document <ExcelDocument>]
[[-EndColumn] <Object>]
[-Hidden]
[-KeepHidden]
[-OutlineLevel <Int32>]
[-PassThru]
[-Sheet <OfficeSheetSelector>]
[-StartColumn] <Object>
[-SummaryLeft]
[<CommonParameters>]
```

[#](#method-set-officeexcelcolumngroup-switchparameter-switchparameter-exceldocument-object-switchparameter-switchparameter-int32-switchparameter-officesheetselector-object-switchparameter)

Parameter set: `Default`

## Examples

### Group monthly columns

```powershell
Open-OfficeExcel -Path .\Reports\Budget-2027.xlsx {
    ExcelSheet 'Departments' {
        ExcelColumnGroup B M
    }
}
```

Groups columns B to M, the monthly figures, next to the yearly total.

### Collapse quarters into their totals

```powershell
Open-OfficeExcel -Path .\Reports\Forecast.xlsx {
    ExcelSheet 'Forecast' {
        ExcelColumnGroup B D -Collapsed
        ExcelColumnGroup F H -Collapsed
        ExcelColumnGroup J L -Collapsed
        ExcelColumnGroup N P -Collapsed
    }
}
```

Groups each quarter's three months and collapses them, so the sheet shows the quarterly totals first.

## Parameters

**-Clear SwitchParameter optional**

Clear column grouping metadata from the target range.

**-Collapsed SwitchParameter optional**

Hide the grouped columns and mark the following summary column as collapsed.

**-Document ExcelDocument optionalpipeline: True (ByValue)**

Caller-owned workbook; omission uses the enclosing Excel content block.

**-EndColumn Object optionalposition: 1**

Last 1-based column in the group. Defaults to the start column.

**-Hidden SwitchParameter optional**

Hide the grouped columns without marking the group collapsed.

**-KeepHidden SwitchParameter optional**

Keep hidden columns hidden when clearing column grouping metadata.

**-OutlineLevel Int32 optional**

Excel outline level from 1 through 7.

**-PassThru SwitchParameter optional**

Emits the native result after the operation.

**-Sheet OfficeSheetSelector optional**

Worksheet name, one-based position or native worksheet object. Multi-sheet commands also accept wildcard names.

**-StartColumn Object requiredposition: 0**

First 1-based column in the group.

**-SummaryLeft SwitchParameter optional**

Places outline summary columns to the left; explicit false places them to the right.

## 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).

<!-- PowerForge markdown artifact sha256:45B30597EEF021CFC76E47F71AE9FE80EA381560ECB11DC727D541A404D57A45 -->
