# Join-OfficeExcelSheet

Appends or merges rows from one worksheet into another.

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 **727**

Forks **84**

Open issues **7**

Total downloads **5,275,783**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-24

Cmdlet 

Aliases: ExcelSheetJoin, ExcelSheetMerge, Merge-OfficeExcelSheet

**Module**

`PSWriteOffice`

**Aliases**

`ExcelSheetJoin` `ExcelSheetMerge` `Merge-OfficeExcelSheet`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Outputs**

`OfficeIMO.Excel.ExcelWorksheetMergeResult`

**Source**

[JoinOfficeExcelSheetCommand.cs:19](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/JoinOfficeExcelSheetCommand.cs#L19) 

Appends or merges rows from one worksheet into another.

## Syntax

```
Join-OfficeExcelSheet
[-BlankRowsBefore <Int32>]
[-IncludeSourceHeader]
[-MatchColumnsByHeader]
[-NoSourceHeader]
[-OverwriteExistingCells]
[-SourceDocument <ExcelDocument>]
[-SourcePath <String>]
[-SourceRange <String>]
-SourceSheet <String>
[-TargetHeaderRow <Int32>]
[-TargetSheet <String>]
[-TargetSheetIndex <Int32>]
[-TargetStartColumn <Int32>]
[-TargetStartRow <Int32>]
[<CommonParameters>]
```

[#](#method-join-officeexcelsheet-int32-switchparameter-switchparameter-switchparameter-switchparameter-exceldocument-string-string-string-int32-string-int32-int32-int32)

Parameter set: `Context`

```
Join-OfficeExcelSheet
[-BlankRowsBefore <Int32>]
[-IncludeSourceHeader]
[-MatchColumnsByHeader]
[-NoSourceHeader]
[-OverwriteExistingCells]
[-Path] <String>
[-SourceDocument <ExcelDocument>]
[-SourcePath <String>]
[-SourceRange <String>]
-SourceSheet <String>
[-TargetHeaderRow <Int32>]
[-TargetSheet <String>]
[-TargetSheetIndex <Int32>]
[-TargetStartColumn <Int32>]
[-TargetStartRow <Int32>]
[<CommonParameters>]
```

[#](#method-join-officeexcelsheet-int32-switchparameter-switchparameter-switchparameter-switchparameter-string-exceldocument-string-string-string-int32-string-int32-int32-int32)

Parameter set: `Path`

```
Join-OfficeExcelSheet
[-BlankRowsBefore <Int32>]
-Document <ExcelDocument>
[-IncludeSourceHeader]
[-MatchColumnsByHeader]
[-NoSourceHeader]
[-OverwriteExistingCells]
[-SourceDocument <ExcelDocument>]
[-SourcePath <String>]
[-SourceRange <String>]
-SourceSheet <String>
[-TargetHeaderRow <Int32>]
[-TargetSheet <String>]
[-TargetSheetIndex <Int32>]
[-TargetStartColumn <Int32>]
[-TargetStartRow <Int32>]
[<CommonParameters>]
```

[#](#method-join-officeexcelsheet-int32-exceldocument-switchparameter-switchparameter-switchparameter-switchparameter-exceldocument-string-string-string-int32-string-int32-int32-int32)

Parameter set: `Document`

## Examples

### Append source rows below a combined sheet.

```powershell
$result = Join-OfficeExcelSheet -Path .\Report.xlsx -TargetSheet Combined -SourceSheet Data -MatchColumnsByHeader -BlankRowsBefore 1
$result |
    Select-Object -Property SourceSheet, TargetSheet, RowsCopied, ColumnsCopied
```

Copies rows from Data into Combined, aligns columns by header, and returns the merge result.

## Parameters

**-BlankRowsBefore Int32 optional**

Blank rows to leave before appended data.

**-IncludeSourceHeader SwitchParameter optional**

Include the source header row in copied rows.

**-MatchColumnsByHeader SwitchParameter optional**

Match source columns to target columns by header text.

**-NoSourceHeader SwitchParameter optional**

Treat the first source row as data instead of a header row.

**-OverwriteExistingCells SwitchParameter optional**

Allow copied values to replace existing target cells.

**-SourceDocument ExcelDocument optional**

Optional source workbook object for cross-workbook joins.

**-SourcePath String optional**

Optional source workbook path for cross-workbook joins.

**-SourceRange String optional**

Source A1 range to copy. Defaults to the source used range.

**-SourceSheet String required**

Source worksheet name.

**-TargetHeaderRow Int32 optional**

1-based target header row when matching columns by header.

**-TargetSheet String optional**

Target worksheet name. Defaults to the current sheet inside an ExcelSheet block.

**-TargetSheetIndex Int32 optional**

Target worksheet index when using a workbook object or path.

**-TargetStartColumn Int32 optional**

1-based target start column. Defaults to the source range start column.

**-TargetStartRow Int32 optional**

1-based target start row. Defaults to appending after the target used range.

**-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path**

Target workbook path to update.

**-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:FD575D7A98AF20607FFD58728F0BC694A6D5C6F7541C596CD8B1CD5097029AFA -->
