API Reference
Cmdlet
Join-OfficeExcelSheet
Appends or merges rows from one worksheet into another.
Remarks
Appends or merges rows from one worksheet into another.
Examples
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:
ContextParameters
- 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 Nullable`1
- 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 Nullable`1
- Target worksheet index when using a workbook object or path.
- TargetStartColumn Nullable`1
- 1-based target start column. Defaults to the source range start column.
- TargetStartRow Nullable`1
- 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:
PathParameters
- BlankRowsBefore Int32
- Blank rows to leave before appended data.
- IncludeSourceHeader SwitchParameter
- Include the source header row in copied rows.
- InputPath String
- Target workbook path to update.
- 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 Nullable`1
- 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 Nullable`1
- Target worksheet index when using a workbook object or path.
- TargetStartColumn Nullable`1
- 1-based target start column. Defaults to the source range start column.
- TargetStartRow Nullable`1
- 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:
DocumentParameters
- BlankRowsBefore Int32
- Blank rows to leave before appended data.
- Document ExcelDocument
- Target workbook to update outside the DSL context.
- 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 Nullable`1
- 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 Nullable`1
- Target worksheet index when using a workbook object or path.
- TargetStartColumn Nullable`1
- 1-based target start column. Defaults to the source range start column.
- TargetStartRow Nullable`1
- 1-based target start row. Defaults to appending after the target used range.
Outputs
OfficeIMO.Excel.ExcelWorksheetMergeResult