API Reference

Cmdlet

Join-OfficeExcelSheet

Aliases: ExcelSheetJoin, ExcelSheetMerge, Merge-OfficeExcelSheet
Namespace PSWriteOffice
Aliases
ExcelSheetJoin ExcelSheetMerge Merge-OfficeExcelSheet
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
OfficeIMO.Excel.ExcelWorksheetMergeResult

Appends or merges rows from one worksheet into another.

Remarks

Appends or merges rows from one worksheet into another.

Examples

Authored help example

Example 1: Append source rows below a combined sheet.

PS>


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

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

Join-OfficeExcelSheet [-BlankRowsBefore <Int32>] [-IncludeSourceHeader] [-MatchColumnsByHeader] [-NoSourceHeader] [-OverwriteExistingCells] [-SourceDocument <ExcelDocument>] [-SourcePath <String>] [-SourceRange <String>] -SourceSheet <String> [-TargetHeaderRow <Nullable`1>] [-TargetSheet <String>] [-TargetSheetIndex <Nullable`1>] [-TargetStartColumn <Nullable`1>] [-TargetStartRow <Nullable`1>] [<CommonParameters>]
#
Parameter set: Context

Parameters

BlankRowsBefore Int32 optionalposition: namedpipeline: False
Blank rows to leave before appended data.
IncludeSourceHeader SwitchParameter optionalposition: namedpipeline: False
Include the source header row in copied rows.
MatchColumnsByHeader SwitchParameter optionalposition: namedpipeline: False
Match source columns to target columns by header text.
NoSourceHeader SwitchParameter optionalposition: namedpipeline: False
Treat the first source row as data instead of a header row.
OverwriteExistingCells SwitchParameter optionalposition: namedpipeline: False
Allow copied values to replace existing target cells.
SourceDocument ExcelDocument optionalposition: namedpipeline: False
Optional source workbook object for cross-workbook joins.
SourcePath String optionalposition: namedpipeline: False
Optional source workbook path for cross-workbook joins.
SourceRange String optionalposition: namedpipeline: False
Source A1 range to copy. Defaults to the source used range.
SourceSheet String requiredposition: namedpipeline: False
Source worksheet name.
TargetHeaderRow Nullable`1 optionalposition: namedpipeline: False
1-based target header row when matching columns by header.
TargetSheet String optionalposition: namedpipeline: False
Target worksheet name. Defaults to the current sheet inside an ExcelSheet block.
TargetSheetIndex Nullable`1 optionalposition: namedpipeline: False
Target worksheet index when using a workbook object or path.
TargetStartColumn Nullable`1 optionalposition: namedpipeline: False
1-based target start column. Defaults to the source range start column.
TargetStartRow Nullable`1 optionalposition: namedpipeline: False
1-based target start row. Defaults to appending after the target used range.

Outputs

OfficeIMO.Excel.ExcelWorksheetMergeResult

Join-OfficeExcelSheet [-BlankRowsBefore <Int32>] [-IncludeSourceHeader] -InputPath <String> [-MatchColumnsByHeader] [-NoSourceHeader] [-OverwriteExistingCells] [-SourceDocument <ExcelDocument>] [-SourcePath <String>] [-SourceRange <String>] -SourceSheet <String> [-TargetHeaderRow <Nullable`1>] [-TargetSheet <String>] [-TargetSheetIndex <Nullable`1>] [-TargetStartColumn <Nullable`1>] [-TargetStartRow <Nullable`1>] [<CommonParameters>]
#
Parameter set: Path

Parameters

BlankRowsBefore Int32 optionalposition: namedpipeline: False
Blank rows to leave before appended data.
IncludeSourceHeader SwitchParameter optionalposition: namedpipeline: False
Include the source header row in copied rows.
InputPath String requiredposition: 0pipeline: Falsealiases: FilePath, Path
Target workbook path to update.
MatchColumnsByHeader SwitchParameter optionalposition: namedpipeline: False
Match source columns to target columns by header text.
NoSourceHeader SwitchParameter optionalposition: namedpipeline: False
Treat the first source row as data instead of a header row.
OverwriteExistingCells SwitchParameter optionalposition: namedpipeline: False
Allow copied values to replace existing target cells.
SourceDocument ExcelDocument optionalposition: namedpipeline: False
Optional source workbook object for cross-workbook joins.
SourcePath String optionalposition: namedpipeline: False
Optional source workbook path for cross-workbook joins.
SourceRange String optionalposition: namedpipeline: False
Source A1 range to copy. Defaults to the source used range.
SourceSheet String requiredposition: namedpipeline: False
Source worksheet name.
TargetHeaderRow Nullable`1 optionalposition: namedpipeline: False
1-based target header row when matching columns by header.
TargetSheet String optionalposition: namedpipeline: False
Target worksheet name. Defaults to the current sheet inside an ExcelSheet block.
TargetSheetIndex Nullable`1 optionalposition: namedpipeline: False
Target worksheet index when using a workbook object or path.
TargetStartColumn Nullable`1 optionalposition: namedpipeline: False
1-based target start column. Defaults to the source range start column.
TargetStartRow Nullable`1 optionalposition: namedpipeline: False
1-based target start row. Defaults to appending after the target used range.

Outputs

OfficeIMO.Excel.ExcelWorksheetMergeResult

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

Parameters

BlankRowsBefore Int32 optionalposition: namedpipeline: False
Blank rows to leave before appended data.
Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Target workbook to update outside the DSL context.
IncludeSourceHeader SwitchParameter optionalposition: namedpipeline: False
Include the source header row in copied rows.
MatchColumnsByHeader SwitchParameter optionalposition: namedpipeline: False
Match source columns to target columns by header text.
NoSourceHeader SwitchParameter optionalposition: namedpipeline: False
Treat the first source row as data instead of a header row.
OverwriteExistingCells SwitchParameter optionalposition: namedpipeline: False
Allow copied values to replace existing target cells.
SourceDocument ExcelDocument optionalposition: namedpipeline: False
Optional source workbook object for cross-workbook joins.
SourcePath String optionalposition: namedpipeline: False
Optional source workbook path for cross-workbook joins.
SourceRange String optionalposition: namedpipeline: False
Source A1 range to copy. Defaults to the source used range.
SourceSheet String requiredposition: namedpipeline: False
Source worksheet name.
TargetHeaderRow Nullable`1 optionalposition: namedpipeline: False
1-based target header row when matching columns by header.
TargetSheet String optionalposition: namedpipeline: False
Target worksheet name. Defaults to the current sheet inside an ExcelSheet block.
TargetSheetIndex Nullable`1 optionalposition: namedpipeline: False
Target worksheet index when using a workbook object or path.
TargetStartColumn Nullable`1 optionalposition: namedpipeline: False
1-based target start column. Defaults to the source range start column.
TargetStartRow Nullable`1 optionalposition: namedpipeline: False
1-based target start row. Defaults to appending after the target used range.

Outputs

OfficeIMO.Excel.ExcelWorksheetMergeResult