# Set-OfficeExcelRowGroup

Groups rows into a collapsible outline, or clears grouping.

Cmdlet 

Aliases: ExcelRowGroup

**Module**

`PSWriteOffice`

**Aliases**

`ExcelRowGroup`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Source**

[SetOfficeExcelRowGroupCommand.cs:36](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Excel/SetOfficeExcelRowGroupCommand.cs#L36) 

Groups rows into a collapsible outline, or clears grouping.

## Syntax

```
Set-OfficeExcelRowGroup
[-Clear]
[-Collapsed]
[-Document <ExcelDocument>]
[[-EndRow] <Int32>]
[-Hidden]
[-KeepHidden]
[-OutlineLevel <Int32>]
[-PassThru]
[-Sheet <OfficeSheetSelector>]
[-StartRow] <Int32>
[-SummaryAbove]
[<CommonParameters>]
```

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

Parameter set: `Default`

## Examples

### Group detail rows

```powershell
Open-OfficeExcel -Path .\Reports\Budget-2027.xlsx {
    ExcelSheet 'Departments' {
        ExcelRowGroup 3 12
    }
}
```

Groups rows 3 to 12 so they can be collapsed under their summary row.

### Collapse each region's detail

```powershell
Open-OfficeExcel -Path .\Reports\Regional-Sales.xlsx {
    ExcelSheet 'Detail' {
        ExcelRowGroup 3 40 -Collapsed -SummaryAbove
        ExcelRowGroup 42 77 -Collapsed -SummaryAbove
        ExcelRowGroup 79 120 -Collapsed -SummaryAbove
    }
}
```

Groups and collapses the detail rows of each region with the summary row above them, so the sheet opens showing only the regional totals.

## Parameters

**-Clear SwitchParameter optional**

Clear row grouping metadata from the target range.

**-Collapsed SwitchParameter optional**

Hide the grouped rows and mark the following summary row as collapsed.

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

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

**-EndRow Int32 optionalposition: 1**

Last 1-based row in the group. Defaults to StartRow.

**-Hidden SwitchParameter optional**

Hide the grouped rows without marking the group collapsed.

**-KeepHidden SwitchParameter optional**

Keep hidden rows hidden when clearing row 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.

**-StartRow Int32 requiredposition: 0**

First 1-based row in the group.

**-SummaryAbove SwitchParameter optional**

Places outline summary rows above detail rows; explicit false places them below.

## 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:BBF44BA4AAB19132FBDAE19C9E902D1F336294C85C9AD1C2979AB2CF220F1D10 -->
