API Reference
Command
Get-OfficeExcelRange
Reads an explicit A1 range from an Excel workbook.
Remarks
Reads an explicit A1 range from an Excel workbook.
Examples
Read a rectangular range as objects.
PS>Get-OfficeExcelRange -Path .\report.xlsx -Sheet 'Data' -Range 'A1:C10'
Uses the first row as headers and returns each remaining row as a PSCustomObject.
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.
Syntax
Get-OfficeExcelRange [-AsDataTable] [-AsHashtable] [-HeadersInFirstRow <Boolean>] -InputPath <String> [-NumericAsDecimal] -Range <String> [-Sheet <String>] [-SheetIndex <Nullable`1>] [<CommonParameters>]#Parameter set:
PathParameters
- AsDataTable SwitchParameter
- Emit the raw DataTable instead of row objects.
- AsHashtable SwitchParameter
- Emit rows as hashtables instead of PSCustomObjects.
- HeadersInFirstRow Boolean
- Use the first row as column headers.
- InputPath String
- Path to the workbook.
- NumericAsDecimal SwitchParameter
- Prefer decimals instead of doubles for numeric values.
- Range String
- A1 range to read.
- Sheet String
- Worksheet name to read; defaults to the first sheet.
- SheetIndex Nullable`1
- Zero-based worksheet index to read; defaults to the first sheet.
Outputs
System.Management.Automation.PSObject System.Collections.Hashtable System.Data.DataTable
Get-OfficeExcelRange [-AsDataTable] [-AsHashtable] -Document <ExcelDocument> [-HeadersInFirstRow <Boolean>] [-NumericAsDecimal] -Range <String> [-Sheet <String>] [-SheetIndex <Nullable`1>] [<CommonParameters>]#Parameter set:
DocumentParameters
- AsDataTable SwitchParameter
- Emit the raw DataTable instead of row objects.
- AsHashtable SwitchParameter
- Emit rows as hashtables instead of PSCustomObjects.
- Document ExcelDocument
- Workbook to inspect.
- HeadersInFirstRow Boolean
- Use the first row as column headers.
- NumericAsDecimal SwitchParameter
- Prefer decimals instead of doubles for numeric values.
- Range String
- A1 range to read.
- Sheet String
- Worksheet name to read; defaults to the first sheet.
- SheetIndex Nullable`1
- Zero-based worksheet index to read; defaults to the first sheet.
Outputs
System.Management.Automation.PSObject System.Collections.Hashtable System.Data.DataTable