mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
29 lines
941 B
PowerShell
29 lines
941 B
PowerShell
function Get-ExcelFileSummary {
|
|
<#
|
|
.Synopsis
|
|
Gets summary information on an Excel file like number of rows, columns, and more
|
|
#>
|
|
param(
|
|
[Parameter(ValueFromPipelineByPropertyName, Mandatory)]
|
|
[Alias('FullName')]
|
|
$Path
|
|
)
|
|
|
|
Process {
|
|
$excel = Open-ExcelPackage -Path $Path
|
|
|
|
foreach ($workSheet in $excel.Workbook.Worksheets) {
|
|
[PSCustomObject][Ordered]@{
|
|
ExcelFile = Split-Path -Leaf $Path
|
|
WorksheetName = $workSheet.Name
|
|
Visible = $workSheet.Hidden -eq 'Visible'
|
|
Rows = $workSheet.Dimension.Rows
|
|
Columns = $workSheet.Dimension.Columns
|
|
Address = $workSheet.Dimension.Address
|
|
Path = Split-Path $Path
|
|
}
|
|
}
|
|
|
|
Close-ExcelPackage -ExcelPackage $excel -NoSave
|
|
}
|
|
} |