# Import-OfficeExcel

Imports rows from an Excel workbook as PowerShell objects.

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: ExcelImport

**Module**

`PSWriteOffice`

**Aliases**

`ExcelImport`

**Inputs**

`Int32` `OfficeIMO.Excel.ExcelDocument` `System.String` `System.Uri`

**Source**

[ImportOfficeExcelCommand.cs:40](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/ImportOfficeExcelCommand.cs#L40) 

Imports rows from an Excel workbook as PowerShell objects.

## Syntax

```
Import-OfficeExcel
[-AllSheets]
[-AsDataReader]
[-AsDataTable]
[-AsHashtable]
[-ByColumn]
[-ChunkRows <Int32>]
[-CultureName <String>]
[-EndColumn <Int32>]
[-EndRow <Int32>]
[-FormulaMode <CachedValue|FormulaText>]
[-NoHeader]
[-NumericAsDecimal]
[-Path] <String>
[-Range <String>]
[-SchemaSampleSize <Int32>]
[-SheetIndex <Int32>]
[-StartColumn <Int32>]
[-StartRow <Int32>]
[-WorksheetName <String>]
[<CommonParameters>]
```

[#](#member-eead74f844d20beb4e3d9a35)

Parameter set: `Path`

```
Import-OfficeExcel
[-AllowHttp]
[-AllSheets]
[-AsDataReader]
[-AsDataTable]
[-AsHashtable]
[-ByColumn]
[-ChunkRows <Int32>]
[-CultureName <String>]
[-EndColumn <Int32>]
[-EndRow <Int32>]
[-FormulaMode <CachedValue|FormulaText>]
[-NoHeader]
[-NumericAsDecimal]
[-Range <String>]
[-SchemaSampleSize <Int32>]
[-SheetIndex <Int32>]
[-StartColumn <Int32>]
[-StartRow <Int32>]
[-Uri] <Uri>
[-WorksheetName <String>]
[<CommonParameters>]
```

[#](#member-930522eda127ceb305cc8e2f)

Parameter set: `Uri`

```
Import-OfficeExcel
[-AllSheets]
[-AsDataReader]
[-AsDataTable]
[-AsHashtable]
[-ByColumn]
[-ChunkRows <Int32>]
[-CultureName <String>]
-Document <ExcelDocument>
[-EndColumn <Int32>]
[-EndRow <Int32>]
[-FormulaMode <CachedValue|FormulaText>]
[-NoHeader]
[-NumericAsDecimal]
[-Range <String>]
[-SchemaSampleSize <Int32>]
[-SheetIndex <Int32>]
[-StartColumn <Int32>]
[-StartRow <Int32>]
[-WorksheetName <String>]
[<CommonParameters>]
```

[#](#member-47adfcffeec99860176a4322)

Parameter set: `Document`

## Description

Provides a fast PowerShell read command over the OfficeIMO reader pipeline.

## Examples

### Import worksheet rows and filter pending items.

```powershell
$rows = Import-OfficeExcel -Path .\Report.xlsx -WorksheetName Data -NumericAsDecimal
$rows |
    Where-Object Status -eq 'Pending' |
    Export-Csv -Path .\PendingRows.csv -NoTypeInformation
```

Reads the used range on the Data worksheet, emits PSCustomObjects, and filters them in PowerShell.

### Import every worksheet and keep the source sheet name.

```powershell
$rows = Import-OfficeExcel -Path .\Workbook.xlsx -AllSheets
$rows | Group-Object WorksheetName
```

Reads the used range from each worksheet and adds a WorksheetName property to each emitted row.

### Import a worksheet by column.

```powershell
Import-OfficeExcel -Path .\Workbook.xlsx -WorksheetName Metrics -ByColumn |
                Where-Object ColumnName -eq 'Revenue' |
                Select-Object -ExpandProperty Values
```

Returns one object per column with the column name, 1-based column index, and the column values as an array.

## Parameters

**-AllSheets SwitchParameter optional**

Import all worksheets. Each emitted row or column includes WorksheetName.

**-AsDataReader SwitchParameter optional**

Emit a forward-only IDataReader for database bulk-copy workflows.

**-AsDataTable SwitchParameter optional**

Emit a DataTable instead of enumerating row objects.

**-AsHashtable SwitchParameter optional**

Emit rows as hashtables instead of PSCustomObjects.

**-ByColumn SwitchParameter optional**

Emit one object per column with ColumnName, ColumnIndex, and Values instead of row objects.

**-ChunkRows Int32 optional**

Worksheet row count requested from each streaming chunk when -AsDataReader is used.

**-CultureName String optional**

Culture used when parsing numbers and dates stored as text.

**-EndColumn Int32 optional**

Ending column for an explicit rectangular range.

**-EndRow Int32 optional**

Ending row for an explicit rectangular range.

**-FormulaMode OfficeExcelFormulaMode optional**

Formula read mode. CachedValue returns workbook cached results; FormulaText returns formula expressions when present.

Possible values: `CachedValue`, `FormulaText`

**-NoHeader SwitchParameter optional**

Treat all rows as data and generate column names instead of using the first row as headers.

**-NumericAsDecimal SwitchParameter optional**

Prefer decimals instead of doubles for numeric values.

**-Path String requiredposition: 0pipeline: True (ByPropertyName)aliases: FilePath, FullName, InputPathsets: Path**

Workbook path to import.

**-Range String optionalpipeline: True (ByPropertyName)**

Optional A1 range to read. When omitted, the used range is imported.

**-SchemaSampleSize Int32 optional**

Maximum row count inspected when -AsDataReader infers the reader schema.

**-SheetIndex Int32 optionalpipeline: True (ByPropertyName)**

Zero-based worksheet index to read.

**-StartColumn Int32 optional**

Starting column for an explicit rectangular range.

**-StartRow Int32 optional**

Starting row for an explicit rectangular range.

**-WorksheetName String optionalpipeline: True (ByPropertyName)aliases: Sheet**

Worksheet name to read; defaults to the first sheet.

**-AllowHttp SwitchParameter optionalsets: Uri**

Allow HTTP workbook downloads in addition to HTTPS.

**-Uri Uri requiredposition: 0pipeline: True (ByPropertyName)aliases: Urlsets: Uri**

Remote workbook URI to import.

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

Workbook document to import from.

## 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:0CF11AA40A1E7CCC7C5464B04411E50EA275300DA22851B277B35170971DFB4A -->
