# Set-OfficeExcelPrintArea

Sets the print area for a worksheet. Review available syntax, parameters, pipeline guidance, and reference details in PSWriteOffice API Reference.

Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **725**

Forks **84**

Open issues **3**

Total downloads **5,231,343**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-23

Cmdlet 

Aliases: ExcelPrintArea

**Module**

`PSWriteOffice`

**Aliases**

`ExcelPrintArea`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Source**

[SetOfficeExcelPrintAreaCommand.cs:20](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/SetOfficeExcelPrintAreaCommand.cs#L20) 

Sets the print area for a worksheet.

## Syntax

```
Set-OfficeExcelPrintArea
[-PassThru]
[-Range] <String>
[-Sheet <String>]
[-SheetIndex <Int32>]
[<CommonParameters>]
```

[#](#method-set-officeexcelprintarea-switchparameter-string-string-int32)

Parameter set: `Context`

```
Set-OfficeExcelPrintArea
[-PassThru]
[-Path] <String>
[-Range] <String>
[-Sheet <String>]
[-SheetIndex <Int32>]
[<CommonParameters>]
```

[#](#method-set-officeexcelprintarea-switchparameter-string-string-string-int32)

Parameter set: `Path`

```
Set-OfficeExcelPrintArea
-Document <ExcelDocument>
[-PassThru]
[-Range] <String>
[-Sheet <String>]
[-SheetIndex <Int32>]
[<CommonParameters>]
```

[#](#method-set-officeexcelprintarea-exceldocument-switchparameter-string-string-int32)

Parameter set: `Document`

## Examples

### Set a print area and keep the workbook printable.

```powershell
$proof = @(
    Set-OfficeExcelPrintArea -Path .\Report.xlsx -Sheet Summary -Range A1:H40
    Set-OfficeExcelPrintTitles -Path .\Report.xlsx -Sheet Summary -FirstRow 1 -LastRow 2
)
$proof
```

Stores the worksheet-local Excel print area and repeats the report header rows for printing.

## Parameters

**-PassThru SwitchParameter optional**

Emit the worksheet after setting the print area.

**-Range String requiredposition: 1**

A1 range to print.

**-Sheet String optionalaliases: WorksheetName**

Worksheet name. Defaults to the current sheet inside an ExcelSheet block.

**-SheetIndex Int32 optional**

Worksheet index when using a workbook object or path.

**-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path**

Workbook path to update.

**-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document**

Workbook to update outside the DSL context.

## 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).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:0BE99AB2524332368B5F5A9A227194E9E18EE188DA53BCF0D26854B8B04AA94E -->
