Cmdlet
Add-OfficeExcelReportSheet
Creates a report worksheet and lays out report blocks inside it.
Syntax
Add-OfficeExcelReportSheet
[-AutoFitRows]
[[-Content] <ScriptBlock>]
[-Document <ExcelDocument>]
[-HeadingFillColor <OfficeColor>]
[-KeyFillColor <OfficeColor>]
[-Name] <String>
[-NoAutoFit]
[-PassThru]
[<CommonParameters>]#Parameter set:
DefaultExamples
Create a report sheet
New-OfficeExcel -Path .\Reports\Operations.xlsx {
ExcelReportSheet 'Summary' {
ExcelReportTitle 'Operations summary' 'Week 43, 2026'
ExcelReportKpi ([ordered]@{ Uptime = '99.97%'; Incidents = 4; 'Changes shipped' = 37 })
}
}Adds a Summary report sheet with a title and a KPI row, laid out by the report builder in the workbook theme.
Build a monthly service review
$sites = Import-OfficeCsv -Path .\Data\Site-Availability.csv
$legend = @(
[pscustomobject]@{ Status = 'Met'; Meaning = 'Availability at or above the 99.9% target' }
[pscustomobject]@{ Status = 'Missed'; Meaning = 'Below target; a service credit may apply' }
)
New-OfficeExcel -Path .\Reports\Service-Review-October.xlsx -Theme Boardroom {
ExcelReportSheet 'Review' {
ExcelReportTitle 'Service review' 'October 2026'
ExcelReportKpi ([ordered]@{ Availability = '99.94%'; 'P1 incidents' = 1; 'Mean time to restore' = '42 min'; 'Changes' = 128 })
ExcelReportCallout Warning 'Two sites missed target' 'Gdansk and Porto were below 99.9% after the network maintenance on 14 October.'
ExcelReportHeading 'Availability by site'
ExcelReportTable $sites 'Sites'
ExcelReportChart -Type Column -Category Site -Value Availability -Title 'Availability by site'
ExcelReportSpacer
ExcelReportLegend 'Status' -Header Status, Meaning -InputObject $legend
}
}Lays out a complete service review: title, KPIs, a callout, a site table with its chart and a legend, all styled by the theme.
Parameters
- -AutoFitRows SwitchParameter
- Auto-fit row heights during composer finalization.
- -Content ScriptBlock
- Excel child commands executed in the current content scope.
- -Document ExcelDocument
- Caller-owned workbook; omission uses the enclosing Excel content block.
- -HeadingFillColor OfficeColor
- Fill colour for report section headings.
- -KeyFillColor OfficeColor
- Override the key-cell fill color used by KPI and property blocks.
- -Name String
- Name of the report worksheet to create.
- -NoAutoFit SwitchParameter
- Retains native column widths without fitting them to the data.
- -PassThru SwitchParameter
- Emits the native result after the operation.
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.