Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

New-OfficeExcelMergeOptions

Module
PSWriteOffice
Inputs
None
Outputs
PSWriteOffice.Models.Excel.ExcelMergeOptions

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: Default

Description

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 $options

Parameters

-CopyMode ExcelWorksheetCopyMode optional
Native value or package copy policy.
Possible values: Values, Package
-NamePrefix String optional
Prefix added to imported worksheet names.
-Sheet OfficeSheetSelector[] optional
Source worksheet names/wildcards, one-based positions or sheet objects from saved appended sources.
-ValidationMode ExcelSheetNameValidationMode optional
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.