Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Add-OfficeExcelReportTable

Aliases: ExcelReportTable
Module
PSWriteOffice
Aliases
ExcelReportTable
Inputs
System.Object

Adds a titled, styled table to the report.

Syntax

Add-OfficeExcelReportTable
[-CollectionSeparator <String>]
[-ColumnFormat <Hashtable>]
[-ExcludeProperty <String[]>]
[-FlattenOptions <OfficeObjectFlattenOptions>]
[-InputObject] <Object>
[-Name <String>]
[-NoAutoFilter]
[-NoAutoFormatDynamicCollections]
[-NoFreeze]
[-NoRowStripes]
[-PassThru]
[-Property <String[]>]
[-ShowColumnStripes]
[-ShowFirstColumn]
[-ShowLastColumn]
[-TableStyle <ExcelTableStyle>]
[[-Title] <String>]
[<CommonParameters>]
#
Parameter set: Default

Examples

Add a titled table

New-OfficeExcel -Path .\Reports\Operations.xlsx {
    ExcelReportSheet 'Summary' {
        ExcelReportTable (Get-Service | Where-Object Status -eq 'Stopped') 'Stopped services'
    }
}

Adds a styled table with a title to the report.

Choose the columns to show

$assets = Import-OfficeCsv -Path .\Data\Assets.csv
New-OfficeExcel -Path .\Reports\Asset-Review.xlsx {
    ExcelReportSheet 'Assets' {
        ExcelReportTitle 'Laptops due for replacement'
        ExcelReportTable ($assets | Where-Object AgeYears -ge 4) 'Due this year' -Property AssetTag, User, Model, Purchased, AgeYears -Name DueLaptops -ColumnFormat @{ Purchased = 'Date'; AgeYears = '0.0' }
    }
}

Shows only the columns readers need from a wide asset export and leaves the internal identifiers out.

Parameters

-CollectionSeparator String optional
Text inserted between collection values flattened into one cell.
-ColumnFormat Hashtable optional
Maps column headers to number-format presets, format codes or per-column option hashtables.
-ExcludeProperty String[] optional
Exclude specific properties from exported objects.
-FlattenOptions OfficeObjectFlattenOptions optional
Nested-value projection policy; accepts a native options object or hashtable.
-InputObject Object requiredposition: 0pipeline: True (ByValue)
Objects, dictionaries or native tabular data supplied directly or through the pipeline.
-Name String optional
Named range name.
-NoAutoFilter SwitchParameter optional
Omits table filter buttons.
-NoAutoFormatDynamicCollections SwitchParameter optional
Disable composer auto-formatting for dynamic collection columns.
-NoFreeze SwitchParameter optional
Keeps the header row scrollable.
-NoRowStripes SwitchParameter optional
Disables alternating row bands. An explicit false value enables them.
-PassThru SwitchParameter optional
Emits the native result after the operation.
-Property String[] optional
Properties to include, in the requested column order.
-ShowColumnStripes SwitchParameter optional
Enables alternating column bands; explicit false clears them.
-ShowFirstColumn SwitchParameter optional
Emphasizes the first table column; explicit false removes the emphasis.
-ShowLastColumn SwitchParameter optional
Emphasizes the last table column; explicit false removes the emphasis.
-TableStyle ExcelTableStyle optional
Built-in table style to apply.
Possible values: TableStyleLight1, TableStyleLight2, TableStyleLight3, TableStyleLight4, TableStyleLight5, TableStyleLight6, TableStyleLight7, TableStyleLight8, TableStyleLight9, TableStyleLight10, TableStyleLight11, TableStyleLight12, TableStyleLight13, TableStyleLight14, TableStyleLight15, TableStyleLight16, TableStyleLight17, TableStyleLight18, TableStyleLight19, TableStyleLight20, TableStyleLight21, TableStyleMedium1, TableStyleMedium2, TableStyleMedium3, TableStyleMedium4, TableStyleMedium5, TableStyleMedium6, TableStyleMedium7, TableStyleMedium8, TableStyleMedium9, TableStyleMedium10, TableStyleMedium11, TableStyleMedium12, TableStyleMedium13, TableStyleMedium14, TableStyleMedium15, TableStyleMedium16, TableStyleMedium17, TableStyleMedium18, TableStyleMedium19, TableStyleMedium20, TableStyleMedium21, TableStyleMedium22, TableStyleMedium23, TableStyleMedium24, TableStyleMedium25, TableStyleMedium26, TableStyleMedium27, TableStyleMedium28, TableStyleDark1, TableStyleDark2, TableStyleDark3, TableStyleDark4, TableStyleDark5, TableStyleDark6, TableStyleDark7, TableStyleDark8, TableStyleDark9, TableStyleDark10, TableStyleDark11
-Title String optionalposition: 1
Chart title.

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.