Cmdlet
Join-OfficeExcelSheet
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>]#Parameter set:
ContextJoin-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>]#Parameter set:
PathJoin-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>]#Parameter set:
DocumentExamples
Append source rows below a combined sheet.
$result = Join-OfficeExcelSheet -Path .\Report.xlsx -TargetSheet Combined -SourceSheet Data -MatchColumnsByHeader -BlankRowsBefore 1
$result |
Select-Object -Property SourceSheet, TargetSheet, RowsCopied, ColumnsCopiedCopies rows from Data into Combined, aligns columns by header, and returns the merge result.
Parameters
- -BlankRowsBefore Int32
- Blank rows to leave before appended data.
- -IncludeSourceHeader SwitchParameter
- Include the source header row in copied rows.
- -MatchColumnsByHeader SwitchParameter
- Match source columns to target columns by header text.
- -NoSourceHeader SwitchParameter
- Treat the first source row as data instead of a header row.
- -OverwriteExistingCells SwitchParameter
- Allow copied values to replace existing target cells.
- -SourceDocument ExcelDocument
- Optional source workbook object for cross-workbook joins.
- -SourcePath String
- Optional source workbook path for cross-workbook joins.
- -SourceRange String
- Source A1 range to copy. Defaults to the source used range.
- -SourceSheet String
- Source worksheet name.
- -TargetHeaderRow Int32
- 1-based target header row when matching columns by header.
- -TargetSheet String
- Target worksheet name. Defaults to the current sheet inside an ExcelSheet block.
- -TargetSheetIndex Int32
- Target worksheet index when using a workbook object or path.
- -TargetStartColumn Int32
- 1-based target start column. Defaults to the source range start column.
- -TargetStartRow Int32
- 1-based target start row. Defaults to appending after the target used range.
- -Path String
- Target workbook path to update.
- -Document ExcelDocument
- 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.