Cmdlet
Move-OfficeExcelSheet
Moves a worksheet to a one-based workbook position.
Syntax
Move-OfficeExcelSheet
[-Document <ExcelDocument>]
[-PassThru]
[-Position] <Int32>
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]#Parameter set:
DefaultDescription
Uses the explicit or enclosing live workbook. Save it explicitly to persist the new order.
Examples
Move the summary worksheet to the front.
$book | Move-OfficeExcelSheet -Sheet Summary -Position 1
Save-OfficeExcel -Document $bookMove a sheet to the front
Open-OfficeExcel -Path .\Reports\Q3-Sales.xlsx {
Move-OfficeExcelSheet -Sheet Summary -Position 1
}Moves the Summary sheet to the first tab position.
Order monthly sheets newest first
$book = Open-OfficeExcel -Path .\Reports\Tickets-2026.xlsx
foreach ($month in 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October') {
Move-OfficeExcelSheet -Document $book -Sheet $month -Position 1
}
Save-OfficeExcel -Document $book -PassThru | Close-OfficeExcelMoves the sheet for each month to the front in turn, so the most recent month ends up first.
Parameters
- -Document ExcelDocument
- Gets or sets an explicit live document; omission uses the enclosing content block.
- -PassThru SwitchParameter
- Gets or sets whether to return the moved native worksheet.
- -Position Int32
- Gets or sets the one-based destination position.
- -Sheet OfficeSheetSelector
- Gets or sets a worksheet name, one-based position or native worksheet.
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.