# Import-OfficeExcel

Reads rows from a worksheet, range or table as objects.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Excel.ExcelDocument` `System.String[]`

**Source**

[ImportOfficeExcelCommand.cs:44](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Excel/ImportOfficeExcelCommand.cs#L44) 

Reads rows from a worksheet, range or table as objects.

## Syntax

```
Import-OfficeExcel
[-As <Object|Hashtable|DataTable|DataReader|Column>]
[-ChunkRows <Int32>]
[-Culture <CultureInfo>]
[-Document <ExcelDocument>]
[-FormulaMode <CachedValue|FormulaText>]
[-NoHeader]
[-NumericAsDecimal]
[-Range <String>]
[-SchemaSampleRows <Int32>]
[-Sheet <OfficeSheetSelector[]>]
[<CommonParameters>]
```

[#](#method-import-officeexcel-excelimportoutput-int32-cultureinfo-exceldocument-officeexcelformulamode-switchparameter-switchparameter-string-int32-officesheetselector)

Parameter set: `Document`

```
Import-OfficeExcel
[-As <Object|Hashtable|DataTable|DataReader|Column>]
[-ChunkRows <Int32>]
[-Culture <CultureInfo>]
[-FormulaMode <CachedValue|FormulaText>]
[-NoHeader]
[-NumericAsDecimal]
[-Path] <String[]>
[-Range <String>]
[-SchemaSampleRows <Int32>]
[-Sheet <OfficeSheetSelector[]>]
[<CommonParameters>]
```

[#](#method-import-officeexcel-excelimportoutput-int32-cultureinfo-officeexcelformulamode-switchparameter-switchparameter-string-string-int32-officesheetselector)

Parameter set: `Path`

```
Import-OfficeExcel
[-As <Object|Hashtable|DataTable|DataReader|Column>]
[-ChunkRows <Int32>]
[-Culture <CultureInfo>]
[-FormulaMode <CachedValue|FormulaText>]
[-NoHeader]
[-NumericAsDecimal]
[-Path] <String[]>
[-SchemaSampleRows <Int32>]
-Table <String>
[<CommonParameters>]
```

[#](#method-import-officeexcel-excelimportoutput-int32-cultureinfo-officeexcelformulamode-switchparameter-switchparameter-string-int32-string)

Parameter set: `PathTable`

```
Import-OfficeExcel
[-As <Object|Hashtable|DataTable|DataReader|Column>]
[-ChunkRows <Int32>]
[-Culture <CultureInfo>]
[-FormulaMode <CachedValue|FormulaText>]
-LiteralPath <String[]>
[-NoHeader]
[-NumericAsDecimal]
[-Range <String>]
[-SchemaSampleRows <Int32>]
[-Sheet <OfficeSheetSelector[]>]
[<CommonParameters>]
```

[#](#method-import-officeexcel-excelimportoutput-int32-cultureinfo-officeexcelformulamode-string-switchparameter-switchparameter-string-int32-officesheetselector)

Parameter set: `LiteralPath`

```
Import-OfficeExcel
[-AllowHttp]
[-AllowPrivateNetworkAddresses]
[-As <Object|Hashtable|DataTable|DataReader|Column>]
[-ChunkRows <Int32>]
[-Culture <CultureInfo>]
[-FormulaMode <CachedValue|FormulaText>]
[-NoHeader]
[-NumericAsDecimal]
[-Range <String>]
[-SchemaSampleRows <Int32>]
[-Sheet <OfficeSheetSelector[]>]
[-Uri] <Uri>
[<CommonParameters>]
```

[#](#method-import-officeexcel-switchparameter-switchparameter-excelimportoutput-int32-cultureinfo-officeexcelformulamode-switchparameter-switchparameter-string-int32-officesheetselector-uri)

Parameter set: `Uri`

```
Import-OfficeExcel
[-As <Object|Hashtable|DataTable|DataReader|Column>]
[-ChunkRows <Int32>]
[-Culture <CultureInfo>]
[-FormulaMode <CachedValue|FormulaText>]
-LiteralPath <String[]>
[-NoHeader]
[-NumericAsDecimal]
[-SchemaSampleRows <Int32>]
-Table <String>
[<CommonParameters>]
```

[#](#method-import-officeexcel-excelimportoutput-int32-cultureinfo-officeexcelformulamode-string-switchparameter-switchparameter-int32-string)

Parameter set: `LiteralPathTable`

```
Import-OfficeExcel
[-AllowHttp]
[-AllowPrivateNetworkAddresses]
[-As <Object|Hashtable|DataTable|DataReader|Column>]
[-ChunkRows <Int32>]
[-Culture <CultureInfo>]
[-FormulaMode <CachedValue|FormulaText>]
[-NoHeader]
[-NumericAsDecimal]
[-SchemaSampleRows <Int32>]
-Table <String>
[-Uri] <Uri>
[<CommonParameters>]
```

[#](#method-import-officeexcel-switchparameter-switchparameter-excelimportoutput-int32-cultureinfo-officeexcelformulamode-switchparameter-switchparameter-int32-string-uri)

Parameter set: `UriTable`

```
Import-OfficeExcel
[-As <Object|Hashtable|DataTable|DataReader|Column>]
[-ChunkRows <Int32>]
[-Culture <CultureInfo>]
[-Document <ExcelDocument>]
[-FormulaMode <CachedValue|FormulaText>]
[-NoHeader]
[-NumericAsDecimal]
[-SchemaSampleRows <Int32>]
-Table <String>
[<CommonParameters>]
```

[#](#method-import-officeexcel-excelimportoutput-int32-cultureinfo-exceldocument-officeexcelformulamode-switchparameter-switchparameter-int32-string)

Parameter set: `DocumentTable`

## Guides & Samples

Authored walkthroughs and practical samples linked to this command.

- [Migrate from PSWriteExcel to PSWriteOffice](/docs/pswriteoffice/migrate-from-pswriteexcel/) Guide
  
  Replace archived PSWriteExcel scripts with maintained PSWriteOffice commands for XLSX creation, import, formulas, charts, and validation.
- [Automate Excel Workbooks](/docs/pswriteoffice/excel/) Guide
  
  Build, inspect, validate, compare, repair, and publish workbook workflows from PowerShell. Includes examples and cmdlet links.
- [Validate and Repair Excel Workbooks](/docs/pswriteoffice/excel-validation-repair/) Guide
  
  Preflight workbook operations, test integrity and accessibility, diagnose package state, and apply deliberate repairs.
- [Read and Import Excel Data](/docs/pswriteoffice/excel-read-import/) Guide
  
  Read worksheets, ranges, tables, and typed rows from existing workbooks without requiring Microsoft Excel.
- [Large Files and Streaming](/docs/excel/large-files/) Guide
  
  Write hundreds of thousands of Excel rows with bounded memory and read large XLSX and XLSB sheets fast with OfficeIMO.Excel streaming APIs.
- [Convert CSV to Excel](/docs/csv/convert-to-excel/) Guide
  
  Import CSV files into Excel worksheets as typed tables and export worksheets back to CSV with OfficeIMO.Excel.Csv, PSWriteOffice, and the officeimo CLI.

## Examples

### Read the first sheet as objects

```powershell
Import-OfficeExcel -Path .\Reports\Q3-Sales.xlsx
```

Reads the used range of the first worksheet, using the header row as property names.

### Find the largest open orders

```powershell
Import-OfficeExcel -Path .\Reports\Q3-Sales.xlsx -Sheet Orders -Range A5 |
                Where-Object Status -eq 'Open' |
                Sort-Object Amount -Descending |
                Select-Object -First 10 OrderId, Customer, Region, Amount
```

Reads the Orders sheet from row 5, where the header starts below a title block, and lists the ten largest open orders.

### Read a named table

```powershell
Import-OfficeExcel -Path .\Reports\Helpdesk.xlsx -Table Tickets |
                Where-Object Status -ne 'Closed' |
                Group-Object Assignee |
                Sort-Object Count -Descending |
                Select-Object Name, Count
```

Reads the rows of the Tickets table wherever it sits in the workbook and counts open tickets per assignee.

### Combine every sheet of many workbooks

```powershell
Get-ChildItem -Path .\Branches -Filter *.xlsx |
                Import-OfficeExcel -Sheet * |
                Export-OfficeExcel -Path .\Reports\All-Branches.xlsx -Sheet 'All branches' -Title 'Branch sales, October 2026'
```

Reads every worksheet of each branch workbook (each row carries its WorksheetName) and writes one consolidated workbook.

## Parameters

**-As ExcelImportOutput optional**

Selects objects, hashtables, a DataTable, an owned IDataReader or column output.

Possible values: `Object`, `Hashtable`, `DataTable`, `DataReader`, `Column`

**-ChunkRows Int32 optional**

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

**-Culture CultureInfo optional**

Culture used for value conversion and number-format presets.

**-Document ExcelDocument optionalpipeline: True (ByValue)sets: Document, DocumentTable**

Caller-owned workbook; omission uses the enclosing Excel content block.

**-FormulaMode OfficeExcelFormulaMode optional**

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

Possible values: `CachedValue`, `FormulaText`

**-NoHeader SwitchParameter optional**

Writes data without a header row.

**-NumericAsDecimal SwitchParameter optional**

Prefer decimals instead of doubles for numeric values.

**-Range String optionalsets: Document, Path, LiteralPath, Uri**

A1 cell range on the selected worksheet.

**-SchemaSampleRows Int32 optional**

Maximum row count inspected when -As DataReader infers the reader schema.

**-Sheet OfficeSheetSelector[] optionalaliases: WorksheetNamesets: Document, Path, LiteralPath, Uri**

Worksheet name, one-based position or native worksheet object. Native worksheet objects need -Document or an enclosing Excel content block. Multi-sheet commands also accept wildcard names.

**-Path String[] requiredposition: 0pipeline: True (ByValue)aliases: FilePathsets: Path, PathTable**

Workbook paths resolved with filesystem wildcard support.

**-Table String requiredsets: PathTable, LiteralPathTable, UriTable, DocumentTable**

Native Excel table used to resolve the source range or header.

**-LiteralPath String[] requiredpipeline: True (ByPropertyName)aliases: FullName, PSPathsets: LiteralPath, LiteralPathTable**

Literal workbook paths, including FileInfo.FullName and provider PSPath.

**-AllowHttp SwitchParameter optionalsets: Uri, UriTable**

Allow HTTP workbook downloads in addition to HTTPS.

**-AllowPrivateNetworkAddresses SwitchParameter optionalsets: Uri, UriTable**

Allow a workbook on a loopback, private, link-local or other non-public network address. Use only for trusted internal sources.

**-Uri Uri requiredposition: 0sets: Uri, UriTable**

Remote workbook URI to import.

## 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:0106245F9E207489694F4627B7615DE6B7C1353D26ADBD7B00A5F897265FE11F -->
