Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars 159
Forks 14
PowerShell Gallery downloads 158,661
Release v3.0.5
Language: C# Updated: 2026-09-03

API Reference

Cmdlet

Move-OfficeExcelSheet

Aliases: ExcelSheetOrder, Set-OfficeExcelSheetOrder
Namespace PSWriteOffice
Aliases
ExcelSheetOrder Set-OfficeExcelSheetOrder
Inputs
OfficeIMO.Excel.ExcelDocument

Moves a worksheet to a new workbook position.

Remarks

Moves a worksheet to a new workbook position.

Examples

Authored help example

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 <Int32>] [<CommonParameters>]
#
Parameter set: Context

Parameters

Index Int32 requiredposition: namedpipeline: Falsealiases: TargetIndex
Zero-based destination tab index.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the moved worksheet.
Sheet String optionalposition: namedpipeline: Falsealiases: WorksheetName
Worksheet name to move. Defaults to the current sheet inside an ExcelSheet block.
SheetIndex Int32 optionalposition: namedpipeline: False
Worksheet index to move when using a workbook object or path.
Move-OfficeExcelSheet -Index <Int32> [-PassThru] -Path <String> [-Sheet <String>] [-SheetIndex <Int32>] [<CommonParameters>]
#
Parameter set: Path

Parameters

Index Int32 requiredposition: namedpipeline: Falsealiases: TargetIndex
Zero-based destination tab index.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the moved worksheet.
Path String requiredposition: 0pipeline: Falsealiases: FilePath, InputPath
Workbook path to update.
Sheet String optionalposition: namedpipeline: Falsealiases: WorksheetName
Worksheet name to move. Defaults to the current sheet inside an ExcelSheet block.
SheetIndex Int32 optionalposition: namedpipeline: False
Worksheet index to move when using a workbook object or path.
Move-OfficeExcelSheet -Document <ExcelDocument> -Index <Int32> [-PassThru] [-Sheet <String>] [-SheetIndex <Int32>] [<CommonParameters>]
#
Parameter set: Document

Parameters

Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to update outside the DSL context.
Index Int32 requiredposition: namedpipeline: Falsealiases: TargetIndex
Zero-based destination tab index.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the moved worksheet.
Sheet String optionalposition: namedpipeline: Falsealiases: WorksheetName
Worksheet name to move. Defaults to the current sheet inside an ExcelSheet block.
SheetIndex Int32 optionalposition: namedpipeline: False
Worksheet index to move when using a workbook object or path.