Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Invoke-OfficeExcelTemplateSheet

Aliases: ExcelTemplateSheet, ExcelTemplateSheets
Module
PSWriteOffice
Aliases
ExcelTemplateSheet ExcelTemplateSheets
Inputs
System.Object
Outputs
System.Int32

Repeats an Excel template worksheet for pipeline data and applies markers in each generated sheet.

Syntax

Invoke-OfficeExcelTemplateSheet
[-CultureName <String>]
[-Item] <Object>
[-MissingValueBehavior <PreserveMarker|EmptyString|Throw>]
[-PassThru]
[-SheetNameProperty <String>]
[-TemplateSheet <String>]
[-ThrowOnMissing]
[<CommonParameters>]
#
Parameter set: Context
Invoke-OfficeExcelTemplateSheet
[-CultureName <String>]
[-Item] <Object>
[-MissingValueBehavior <PreserveMarker|EmptyString|Throw>]
[-PassThru]
[-Path] <String>
[-SheetNameProperty <String>]
[-TemplateSheet <String>]
[-ThrowOnMissing]
[<CommonParameters>]
#
Parameter set: Path
Invoke-OfficeExcelTemplateSheet
[-CultureName <String>]
-Document <ExcelDocument>
[-Item] <Object>
[-MissingValueBehavior <PreserveMarker|EmptyString|Throw>]
[-PassThru]
[-SheetNameProperty <String>]
[-TemplateSheet <String>]
[-ThrowOnMissing]
[<CommonParameters>]
#
Parameter set: Document

Examples

Create one invoice worksheet per pipeline object.

$invoices | Invoke-OfficeExcelTemplateSheet -Path .\Invoices.xlsx -TemplateSheet Template -SheetNameProperty SheetName

Uses the template sheet for the first object, copies it for later objects, binds markers, and saves the workbook.

Parameters

-CultureName String optional
Culture name used for built-in marker format aliases such as currency and date.
-Item Object requiredposition: 1pipeline: True (ByValue)aliases: Data, InputObject, 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 item.
Possible values: PreserveMarker, EmptyString, Throw
-PassThru SwitchParameter optional
Returns the number of marker replacements.
-SheetNameProperty String optionalaliases: NameProperty
Input property used as the generated worksheet name.
-TemplateSheet String optionalaliases: Sheet, WorksheetName
Template worksheet name. Defaults to the current sheet inside an ExcelSheet block or the first sheet for path/document use.
-ThrowOnMissing SwitchParameter optional
Throws when a marker is not supplied by an input item.
-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path
Workbook path to update.
-Document ExcelDocument requiredsets: 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.