# Move-OfficeExcelSheet

Moves a worksheet to a one-based workbook position.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Outputs**

`OfficeIMO.Excel.ExcelSheet`

**Source**

[MoveOfficeExcelSheetCommand.cs:31](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Excel/MoveOfficeExcelSheetCommand.cs#L31) 

Moves a worksheet to a one-based workbook position.

## Syntax

```
Move-OfficeExcelSheet
[-Document <ExcelDocument>]
[-PassThru]
[-Position] <Int32>
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]
```

[#](#method-move-officeexcelsheet-exceldocument-switchparameter-int32-officesheetselector)

Parameter set: `Default`

## Description

Uses the explicit or enclosing live workbook. Save it explicitly to persist the new order.

## Examples

### Move the summary worksheet to the front.

```powershell
$book | Move-OfficeExcelSheet -Sheet Summary -Position 1
Save-OfficeExcel -Document $book
```

### Move a sheet to the front

```powershell
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

```powershell
$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-OfficeExcel
```

Moves the sheet for each month to the front in turn, so the most recent month ends up first.

## Parameters

**-Document ExcelDocument optionalpipeline: True (ByValue)**

Gets or sets an explicit live document; omission uses the enclosing content block.

**-PassThru SwitchParameter optional**

Gets or sets whether to return the moved native worksheet.

**-Position Int32 requiredposition: 0**

Gets or sets the one-based destination position.

**-Sheet OfficeSheetSelector optionalaliases: WorksheetName**

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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

<!-- PowerForge markdown artifact sha256:2446BFC0266C7EE3385560C66AE3D99E8C254C30CEAF70EE6E8BE42D02792862 -->
