API Reference
Cmdlet
Invoke-OfficeExcelTemplate
Applies Excel template markers such as {{Name}} to one or more worksheets.
Remarks
Applies Excel template markers such as {{Name}} to one or more worksheets.
Examples
Fill a workbook template from a hashtable.
PS>
Invoke-OfficeExcelTemplate -Path .\Invoice.xlsx -Sheet Invoice -Value @{ Number = 'INV-001'; Total = 123.45 } -CultureName en-US
Replaces matching template markers and saves the workbook.
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.
Syntax
Invoke-OfficeExcelTemplate [-CultureName <String>] [-MissingValueBehavior <Nullable`1>] [-PassThru] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-ThrowOnMissing] -Value <Hashtable> [<CommonParameters>]#Parameter set:
ContextParameters
- CultureName String
- Culture name used for built-in marker format aliases such as currency and date.
- MissingValueBehavior Nullable`1
- Behavior used when a marker is not supplied by -Value.
- PassThru SwitchParameter
- Returns the number of marker replacements.
- Sheet String
- Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.
- SheetIndex Nullable`1
- Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.
- ThrowOnMissing SwitchParameter
- Throws when a marker is not supplied by -Value.
- Value Hashtable
- Template marker values keyed by marker name.
Outputs
System.Int32
Invoke-OfficeExcelTemplate [-CultureName <String>] -InputPath <String> [-MissingValueBehavior <Nullable`1>] [-PassThru] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-ThrowOnMissing] -Value <Hashtable> [<CommonParameters>]#Parameter set:
PathParameters
- CultureName String
- Culture name used for built-in marker format aliases such as currency and date.
- InputPath String
- Workbook path to update.
- MissingValueBehavior Nullable`1
- Behavior used when a marker is not supplied by -Value.
- PassThru SwitchParameter
- Returns the number of marker replacements.
- Sheet String
- Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.
- SheetIndex Nullable`1
- Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.
- ThrowOnMissing SwitchParameter
- Throws when a marker is not supplied by -Value.
- Value Hashtable
- Template marker values keyed by marker name.
Outputs
System.Int32
Invoke-OfficeExcelTemplate [-CultureName <String>] -Document <ExcelDocument> [-MissingValueBehavior <Nullable`1>] [-PassThru] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-ThrowOnMissing] -Value <Hashtable> [<CommonParameters>]#Parameter set:
DocumentParameters
- CultureName String
- Culture name used for built-in marker format aliases such as currency and date.
- Document ExcelDocument
- Workbook to update outside the DSL context.
- MissingValueBehavior Nullable`1
- Behavior used when a marker is not supplied by -Value.
- PassThru SwitchParameter
- Returns the number of marker replacements.
- Sheet String
- Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.
- SheetIndex Nullable`1
- Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.
- ThrowOnMissing SwitchParameter
- Throws when a marker is not supplied by -Value.
- Value Hashtable
- Template marker values keyed by marker name.
Outputs
System.Int32