Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Invoke-OfficeExcelTemplateRow

Aliases: ExcelTemplateRow, ExcelTemplateRows
Module PSWriteOffice
Aliases
ExcelTemplateRow ExcelTemplateRows
Inputs
OfficeIMO.Excel.ExcelDocument System.Object
Outputs
System.Int32

Repeats an Excel template row for pipeline data and replaces markers in each inserted row.

Syntax

Invoke-OfficeExcelTemplateRow [-CultureName <String>] [-InputObject] <Object> [-MissingValueBehavior <PreserveMarker|EmptyString|Throw>] [-PassThru] [-Sheet <String>] [-SheetIndex <Int32>] -TemplateRow <Int32> [-ThrowOnMissing] [<CommonParameters>]
#
Parameter set: Context
Invoke-OfficeExcelTemplateRow [-CultureName <String>] [-InputObject] <Object> [-MissingValueBehavior <PreserveMarker|EmptyString|Throw>] [-PassThru] [-Path] <String> [-Sheet <String>] [-SheetIndex <Int32>] -TemplateRow <Int32> [-ThrowOnMissing] [<CommonParameters>]
#
Parameter set: Path
Invoke-OfficeExcelTemplateRow [-CultureName <String>] -Document <ExcelDocument> [-InputObject] <Object> [-MissingValueBehavior <PreserveMarker|EmptyString|Throw>] [-PassThru] [-Sheet <String>] [-SheetIndex <Int32>] -TemplateRow <Int32> [-ThrowOnMissing] [<CommonParameters>]
#
Parameter set: Document

Examples

Authored help example

Fill invoice line rows from pipeline objects.

$items | Invoke-OfficeExcelTemplateRow -Path .\Invoice.xlsx -Sheet Invoice -TemplateRow 12 -CultureName en-US

Copies the template row once per input object, applies marker values, and saves the workbook.

Parameters

-CultureName String optional
Culture name used for built-in marker format aliases such as currency and date.
-InputObject Object requiredposition: 1pipeline: True (ByValue)aliases: Data, Rows
Pipeline data. Hashtables, dictionaries, PSCustomObjects, and typed objects are supported.
-MissingValueBehavior ExcelTemplateMissingValueBehavior optional
Behavior used when a marker is not supplied by each input row.
Possible values: PreserveMarker, EmptyString, Throw
-PassThru SwitchParameter optional
Returns the number of marker replacements.
-Sheet String optional
Worksheet name. Defaults to the current sheet inside an ExcelSheet block.
-SheetIndex Int32 optional
Worksheet index when using a workbook object or path.
-TemplateRow Int32 required
1-based row number that contains template markers to repeat.
-ThrowOnMissing SwitchParameter optional
Throws when a marker is not supplied by an input row.
-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path
Workbook path to update.
-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document
Workbook to update outside the DSL context.

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.