Cmdlet
Add-OfficeExcelTableRow
Appends rows to an existing Excel table.
Syntax
Add-OfficeExcelTableRow
[-Document <ExcelDocument>]
[-InputObject] <Object>
[-PassThru]
[-Sheet <OfficeSheetSelector>]
-Table <Object>
[<CommonParameters>]#Parameter set:
DefaultExamples
Append rows to a table
$servers = @(
[pscustomobject]@{ Name = 'NW-APP-07'; Role = 'Application'; Site = 'Warsaw' }
[pscustomobject]@{ Name = 'NW-SQL-03'; Role = 'Database'; Site = 'Frankfurt' }
)
Open-OfficeExcel -Path .\Reports\Inventory.xlsx {
Add-OfficeExcelTableRow -Sheet Servers -Table Servers -InputObject $servers
}Adds two new servers to the Servers table; the table range grows to include them.
Log each deployment as it finishes
$book = Open-OfficeExcel -Path .\Reports\Deployments.xlsx
foreach ($target in 'NW-APP-01', 'NW-APP-02', 'NW-APP-03') {
$result = Invoke-Command -ComputerName $target { & C:\Deploy\Install.ps1 -Release '2026.10.2' }
[pscustomobject]@{ Server = $target; Release = '2026.10.2'; Finished = Get-Date; Status = $result.Status } |
Add-OfficeExcelTableRow -Document $book -Sheet Log -Table Deployments
}
Save-OfficeExcel -Document $book -PassThru | Close-OfficeExcelAppends one row per completed deployment to the Deployments table of a workbook kept open for the whole run.
Parameters
- -Document ExcelDocument
- Caller-owned workbook; omission uses the enclosing Excel content block.
- -InputObject Object
- Objects, dictionaries or native tabular data supplied directly or through the pipeline.
- -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.
- -Table Object
- Native Excel table used to resolve the source range or header.
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.