Cmdlet
Set-OfficeExcelColumnGroup
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>]#Parameter set:
DefaultExamples
Group monthly columns
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
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
- Clear column grouping metadata from the target range.
- -Collapsed SwitchParameter
- Hide the grouped columns and mark the following summary column as collapsed.
- -Document ExcelDocument
- Caller-owned workbook; omission uses the enclosing Excel content block.
- -EndColumn Object
- Last 1-based column in the group. Defaults to the start column.
- Hide the grouped columns without marking the group collapsed.
- Keep hidden columns hidden when clearing column grouping metadata.
- -OutlineLevel Int32
- Excel outline level from 1 through 7.
- -PassThru SwitchParameter
- Emits the native result after the operation.
- -Sheet OfficeSheetSelector
- Worksheet name, one-based position or native worksheet object. Multi-sheet commands also accept wildcard names.
- -StartColumn Object
- First 1-based column in the group.
- -SummaryLeft SwitchParameter
- 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.