Import-OfficeExcel
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>]#DocumentImport-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>]#PathImport-OfficeExcel
[-As <Object| Hashtable| DataTable| DataReader| Column>]
[-ChunkRows <Int32>]
[-Culture <CultureInfo>]
[-FormulaMode <CachedValue| FormulaText>]
[-NoHeader]
[-NumericAsDecimal]
[-Path] <String[]>
[-SchemaSampleRows <Int32>]
-Table <String>
[<CommonParameters>]#PathTableImport-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>]#LiteralPathImport-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>]#UriImport-OfficeExcel
[-As <Object| Hashtable| DataTable| DataReader| Column>]
[-ChunkRows <Int32>]
[-Culture <CultureInfo>]
[-FormulaMode <CachedValue| FormulaText>]
-LiteralPath <String[]>
[-NoHeader]
[-NumericAsDecimal]
[-SchemaSampleRows <Int32>]
-Table <String>
[<CommonParameters>]#LiteralPathTableImport-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>]#UriTableImport-OfficeExcel
[-As <Object| Hashtable| DataTable| DataReader| Column>]
[-ChunkRows <Int32>]
[-Culture <CultureInfo>]
[-Document <ExcelDocument>]
[-FormulaMode <CachedValue| FormulaText>]
[-NoHeader]
[-NumericAsDecimal]
[-SchemaSampleRows <Int32>]
-Table <String>
[<CommonParameters>]#DocumentTableExamples
Read the first sheet as objects
Import-OfficeExcel -Path .\Reports\Q3-Sales.xlsxReads the used range of the first worksheet, using the header row as property names.
Find the largest open orders
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, AmountReads 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
Import-OfficeExcel -Path .\Reports\Helpdesk.xlsx -Table Tickets |
Where-Object Status -ne 'Closed' |
Group-Object Assignee |
Sort-Object Count -Descending |
Select-Object Name, CountReads the rows of the Tickets table wherever it sits in the workbook and counts open tickets per assignee.
Combine every sheet of many workbooks
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
- Selects objects, hashtables, a DataTable, an owned IDataReader or column output.
- Possible values:
Object,Hashtable,DataTable,DataReader,Column - -ChunkRows Int32
- Worksheet row count requested from each streaming chunk when -As DataReader is used.
- -Culture CultureInfo
- Culture used for value conversion and number-format presets.
- -Document ExcelDocument
- Caller-owned workbook; omission uses the enclosing Excel content block.
- -FormulaMode OfficeExcelFormulaMode
- Formula read mode. CachedValue returns workbook cached results; FormulaText returns formula expressions when present.
- Possible values:
CachedValue,FormulaText - -NoHeader SwitchParameter
- Writes data without a header row.
- -NumericAsDecimal SwitchParameter
- Prefer decimals instead of doubles for numeric values.
- -Range String
- A1 cell range on the selected worksheet.
- -SchemaSampleRows Int32
- Maximum row count inspected when -As DataReader infers the reader schema.
- -Sheet OfficeSheetSelector[]
- 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[]
- Workbook paths resolved with filesystem wildcard support.
- -Table String
- Native Excel table used to resolve the source range or header.
- -LiteralPath String[]
- Literal workbook paths, including FileInfo.FullName and provider PSPath.
- -AllowHttp SwitchParameter
- Allow HTTP workbook downloads in addition to HTTPS.
- -AllowPrivateNetworkAddresses SwitchParameter
- Allow a workbook on a loopback, private, link-local or other non-public network address. Use only for trusted internal sources.
- -Uri Uri
- 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.