API Reference
Cmdlet
Move-OfficeExcelSheet
Moves a worksheet to a new workbook position.
Remarks
Moves a worksheet to a new workbook position.
Examples
Move the summary sheet to the front and verify order.
PS>
$proof = @(
Move-OfficeExcelSheet -Path .\Report.xlsx -Sheet Summary -Index 0
Get-OfficeExcelSummary -Path .\Report.xlsx -IncludeSheets |
Select-Object -ExpandProperty Sheets |
Select-Object -First 3 -Property Index, Name
)
$proof
Moves Summary to the first worksheet tab and reads back the first sheets from workbook summary.
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
Move-OfficeExcelSheet -Index <Int32> [-PassThru] [-Sheet <String>] [-SheetIndex <Nullable`1>] [<CommonParameters>]#Parameter set:
ContextParameters
- Index Int32
- Zero-based destination tab index.
- PassThru SwitchParameter
- Emit the moved worksheet.
- Sheet String
- Worksheet name to move. Defaults to the current sheet inside an ExcelSheet block.
- SheetIndex Nullable`1
- Worksheet index to move when using a workbook object or path.
Outputs
System.Object
Move-OfficeExcelSheet -Index <Int32> -InputPath <String> [-PassThru] [-Sheet <String>] [-SheetIndex <Nullable`1>] [<CommonParameters>]#Parameter set:
PathParameters
- Index Int32
- Zero-based destination tab index.
- InputPath String
- Workbook path to update.
- PassThru SwitchParameter
- Emit the moved worksheet.
- Sheet String
- Worksheet name to move. Defaults to the current sheet inside an ExcelSheet block.
- SheetIndex Nullable`1
- Worksheet index to move when using a workbook object or path.
Outputs
System.Object
Move-OfficeExcelSheet -Document <ExcelDocument> -Index <Int32> [-PassThru] [-Sheet <String>] [-SheetIndex <Nullable`1>] [<CommonParameters>]#Parameter set:
DocumentParameters
- Document ExcelDocument
- Workbook to update outside the DSL context.
- Index Int32
- Zero-based destination tab index.
- PassThru SwitchParameter
- Emit the moved worksheet.
- Sheet String
- Worksheet name to move. Defaults to the current sheet inside an ExcelSheet block.
- SheetIndex Nullable`1
- Worksheet index to move when using a workbook object or path.
Outputs
System.Object