# Get-OfficeExcelRange

Reads an explicit A1 range from an Excel workbook. 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 **727**

Forks **84**

Open issues **7**

Total downloads **5,275,783**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-24

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Outputs**

`System.Management.Automation.PSObject` `System.Collections.Hashtable` `System.Data.DataTable`

**Source**

[GetOfficeExcelRangeCommand.cs:24](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/GetOfficeExcelRangeCommand.cs#L24) 

Reads an explicit A1 range from an Excel workbook.

## Syntax

```
Get-OfficeExcelRange
[-AsDataTable]
[-AsHashtable]
[-HeadersInFirstRow <Boolean>]
[-NumericAsDecimal]
[-Path] <String>
-Range <String>
[-Sheet <String>]
[-SheetIndex <Int32>]
[<CommonParameters>]
```

[#](#method-get-officeexcelrange-switchparameter-switchparameter-boolean-switchparameter-string-string-string-int32)

Parameter set: `Path`

```
Get-OfficeExcelRange
[-AllowHttp]
[-AsDataTable]
[-AsHashtable]
[-HeadersInFirstRow <Boolean>]
[-NumericAsDecimal]
-Range <String>
[-Sheet <String>]
[-SheetIndex <Int32>]
[-Uri] <Uri>
[<CommonParameters>]
```

[#](#method-get-officeexcelrange-switchparameter-switchparameter-switchparameter-boolean-switchparameter-string-string-int32-uri)

Parameter set: `Uri`

```
Get-OfficeExcelRange
[-AsDataTable]
[-AsHashtable]
-Document <ExcelDocument>
[-HeadersInFirstRow <Boolean>]
[-NumericAsDecimal]
-Range <String>
[-Sheet <String>]
[-SheetIndex <Int32>]
[<CommonParameters>]
```

[#](#method-get-officeexcelrange-switchparameter-switchparameter-exceldocument-boolean-switchparameter-string-string-int32)

Parameter set: `Document`

## Description

Returns rows as PSCustomObjects by default, with optional hashtable or DataTable output for scripting and interoperability.

## Examples

### Read a rectangular range and summarize revenue.

```powershell
$rows = Get-OfficeExcelRange -Path .\report.xlsx -Sheet Data -Range A1:C10 -NumericAsDecimal
$rows |
    Group-Object -Property Region |
    Select-Object Name, Count
```

Uses the first row as headers, returns row objects, and keeps numeric values decimal-friendly.

## Parameters

**-AsDataTable SwitchParameter optional**

Emit the raw DataTable instead of row objects.

**-AsHashtable SwitchParameter optional**

Emit rows as hashtables instead of PSCustomObjects.

**-HeadersInFirstRow Boolean optional**

Use the first row as column headers.

**-NumericAsDecimal SwitchParameter optional**

Prefer decimals instead of doubles for numeric values.

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

Path to the workbook.

**-Range String required**

A1 range to read.

**-Sheet String optional**

Worksheet name to read; defaults to the first sheet.

**-SheetIndex Int32 optional**

Zero-based worksheet index to read; defaults to the first sheet.

**-AllowHttp SwitchParameter optionalsets: Uri**

Allow HTTP workbook downloads in addition to HTTPS.

**-Uri Uri requiredposition: 0aliases: Urlsets: Uri**

Remote workbook URI to read.

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

Workbook to inspect.

## 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:7C91A807536002B48B7C13765E56150156758EB908EEF1739629C1221FC81412 -->
