Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Add-OfficeExcelTableRow

Module
PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelDocument System.Object

Appends rows to an existing Excel table.

Syntax

Add-OfficeExcelTableRow
[-Document <ExcelDocument>]
[-InputObject] <Object>
[-PassThru]
[-Sheet <OfficeSheetSelector>]
-Table <Object>
[<CommonParameters>]
#
Parameter set: Default

Examples

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-OfficeExcel

Appends one row per completed deployment to the Deployments table of a workbook kept open for the whole run.

Parameters

-Document ExcelDocument optionalpipeline: True (ByValue)
Caller-owned workbook; omission uses the enclosing Excel content block.
-InputObject Object requiredposition: 1pipeline: True (ByValue)
Objects, dictionaries or native tabular data supplied directly or through the pipeline.
-PassThru SwitchParameter optional
Emits the native result after the operation.
-Sheet OfficeSheetSelector optionalaliases: WorksheetName
Worksheet name, one-based position or native worksheet object. Multi-sheet commands also accept wildcard names.
-Table Object required
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.