# Join-OfficeExcelWorkbook

Merges worksheets from one or more workbooks into a target workbook.

Project

PSWriteOffice

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

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **725**

Forks **84**

Open issues **3**

Total downloads **5,231,343**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-23

Cmdlet 

Aliases: ExcelWorkbookJoin, ExcelWorkbookMerge, Merge-OfficeExcelWorkbook

**Module**

`PSWriteOffice`

**Aliases**

`ExcelWorkbookJoin` `ExcelWorkbookMerge` `Merge-OfficeExcelWorkbook`

**Inputs**

`OfficeIMO.Excel.ExcelDocument` `System.String[]`

**Outputs**

`OfficeIMO.Excel.ExcelWorkbookMergeResult`

**Source**

[JoinOfficeExcelWorkbookCommand.cs:29](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/JoinOfficeExcelWorkbookCommand.cs#L29) 

Merges worksheets from one or more workbooks into a target workbook.

## Syntax

```
Join-OfficeExcelWorkbook
[-CopyMode <Values|Package>]
[-Path] <String>
[-SheetNamePrefix <String>]
[-SourceDocument <ExcelDocument>]
[[-SourcePath] <String[]>]
[-SourceSheet <String[]>]
[-ValidationMode <Sanitize|Strict>]
[<CommonParameters>]
```

[#](#method-join-officeexcelworkbook-excelworksheetcopymode-string-string-exceldocument-string-string-excelsheetnamevalidationmode)

Parameter set: `Path`

```
Join-OfficeExcelWorkbook
[-CopyMode <Values|Package>]
-Document <ExcelDocument>
[-SheetNamePrefix <String>]
[-SourceDocument <ExcelDocument>]
[[-SourcePath] <String[]>]
[-SourceSheet <String[]>]
[-ValidationMode <Sanitize|Strict>]
[<CommonParameters>]
```

[#](#method-join-officeexcelworkbook-excelworksheetcopymode-exceldocument-string-exceldocument-string-string-excelsheetnamevalidationmode)

Parameter set: `Document`

## Examples

### Merge workbook sheets using the package fast path.

```powershell
$sources = Get-ChildItem .\Incoming\*.xlsx | Select-Object -ExpandProperty FullName
$results = Join-OfficeExcelWorkbook -Path .\Combined.xlsx -SourcePath $sources -CopyMode Package -SheetNamePrefix Import
$results | Select-Object SheetCount, SourceSheets, TargetSheets
```

Copies worksheets between packages without importing rows into PowerShell objects, which is the preferred path for large workbook merge workflows.

### Import selected source sheets with a prefix.

```powershell
$merge = Join-OfficeExcelWorkbook -Path .\Target.xlsx -SourcePath .\Source.xlsx -SourceSheet Data,Summary -SheetNamePrefix 'Imported '
Get-OfficeExcelSummary -Path .\Target.xlsx |
    Select-Object Path, WorksheetCount
```

Copies selected worksheets from Source.xlsx into Target.xlsx using OfficeIMO workbook merge logic.

## Parameters

**-CopyMode ExcelWorksheetCopyMode optional**

Controls whether cross-workbook copies use package-level copy or value materialization.

Possible values: `Values`, `Package`

**-Path String requiredposition: 0aliases: FilePath, InputPath, OutputPathsets: Path**

Target workbook path to create or update.

**-SheetNamePrefix String optional**

Prefix added to every imported worksheet name.

**-SourceDocument ExcelDocument optional**

Optional source workbook object.

**-SourcePath String[] optionalposition: 1pipeline: True (ByPropertyName)aliases: FullName, LiteralPath**

Source workbook paths to merge into the target workbook.

**-SourceSheet String[] optionalaliases: Sheet, SheetName, WorksheetName**

Specific source worksheet names to import. Defaults to all source sheets.

**-ValidationMode ExcelSheetNameValidationMode optional**

Controls how invalid or duplicate destination sheet names are handled.

Possible values: `Sanitize`, `Strict`

**-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document**

Target 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:E2263CFD9A33F0747C56E0E65CAC5D8C83E8B405B15FB0E0D4EC7A64F20BE682 -->
