Cmdlet
New-OfficeExcelMergeOptions
Creates native import policies and typed worksheet selections for Merge-OfficeDocument.
Syntax
New-OfficeExcelMergeOptions
[-CopyMode <Values| Package>]
[-NamePrefix <String>]
[-Sheet <OfficeSheetSelector[]>]
[-ValidationMode <Sanitize| Strict>]
[<CommonParameters>]#Parameter set:
DefaultDescription
The first input or live Document remains the base. Sheet selects appended source worksheets; sheet objects identify worksheets in saved source files and remain caller-owned.
Examples
Append selected worksheets while retaining native package content.
$options = New-OfficeExcelMergeOptions -Sheet 'Sales*', 3 -NamePrefix 'Imported ' -CopyMode Package
Merge-OfficeDocument -Path ./Cover.xlsx, ./North.xlsx, ./South.xlsx -OutputPath ./Combined.xlsx -Options $optionsParameters
- -CopyMode ExcelWorksheetCopyMode
- Native value or package copy policy.
- Possible values:
Values,Package - -NamePrefix String
- Prefix added to imported worksheet names.
- -Sheet OfficeSheetSelector[]
- Source worksheet names/wildcards, one-based positions or sheet objects from saved appended sources.
- -ValidationMode ExcelSheetNameValidationMode
- Native imported-sheet name validation policy.
- Possible values:
Sanitize,Strict
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.
Outputs
PSWriteOffice.Models.Excel.ExcelMergeOptions: Combines native workbook import policies with PowerShell worksheet selectors.