diff --git a/ImportExcel.psd1 b/ImportExcel.psd1 index 52458a4..ac4fc38 100644 --- a/ImportExcel.psd1 +++ b/ImportExcel.psd1 @@ -6,7 +6,7 @@ RootModule = 'ImportExcel.psm1' # Version number of this module. - ModuleVersion = '7.8.1' + ModuleVersion = '7.8.2' # ID used to uniquely identify this module GUID = '60dd4136-feff-401a-ba27-a84458c57ede' diff --git a/Public/Get-ExcelFileSummary.ps1 b/Public/Get-ExcelFileSummary.ps1 index 6aeae2f..3ffec1e 100644 --- a/Public/Get-ExcelFileSummary.ps1 +++ b/Public/Get-ExcelFileSummary.ps1 @@ -16,6 +16,7 @@ function Get-ExcelFileSummary { [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 diff --git a/__tests__/Get-ExcelFileSummary.Tests.ps1 b/__tests__/Get-ExcelFileSummary.Tests.ps1 index 38fc9eb..b6e2edb 100644 --- a/__tests__/Get-ExcelFileSummary.Tests.ps1 +++ b/__tests__/Get-ExcelFileSummary.Tests.ps1 @@ -3,9 +3,7 @@ [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', '', Justification = 'Only executes on versions without the automatic variable')] param() -if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) { - Import-Module $PSScriptRoot\..\ImportExcel.psd1 -} +Import-Module $PSScriptRoot\..\ImportExcel.psd1 -Force Describe 'All tests for Get-ExcelFileSummary' -Tag "Get-ExcelFileSummary" { Context "Test Get-ExcelFileSummary" { @@ -14,6 +12,7 @@ Describe 'All tests for Get-ExcelFileSummary' -Tag "Get-ExcelFileSummary" { $actual.ExcelFile | Should -BeExactly 'TestData1.xlsx' $actual.WorksheetName | Should -BeExactly 'Sheet1' + $actual.Visible | Should -BeTrue $actual.Rows | Should -Be 3 $actual.Columns | Should -Be 2 $actual.Address | Should -BeExactly 'A1:B3' @@ -26,6 +25,7 @@ Describe 'All tests for Get-ExcelFileSummary' -Tag "Get-ExcelFileSummary" { $actual[0].ExcelFile | Should -BeExactly 'MultipleSheets.xlsx' $actual[0].WorksheetName | Should -BeExactly 'Sheet1' + $actual[0].Visible | Should -BeTrue $actual[0].Rows | Should -Be 1 $actual[0].Columns | Should -Be 4 $actual[0].Address | Should -BeExactly 'A1:D1' @@ -33,11 +33,20 @@ Describe 'All tests for Get-ExcelFileSummary' -Tag "Get-ExcelFileSummary" { $actual[1].ExcelFile | Should -BeExactly 'MultipleSheets.xlsx' $actual[1].WorksheetName | Should -BeExactly 'Sheet2' + $actual[1].Visible | Should -BeTrue $actual[1].Rows | Should -Be 2 $actual[1].Columns | Should -Be 2 $actual[1].Address | Should -BeExactly 'A1:B2' $actual[1].Path | Should -Not -BeNullOrEmpty } + It "Tests if sheet is hidden or not" { + $actual = Get-ExcelFileSummary "$PSScriptRoot\ImportExcelTests\SheetVisibleTesting.xlsx" + + $actual[0].Visible | Should -BeTrue + $actual[1].Visible | Should -BeFalse + $actual[2].Visible | Should -BeTrue + $actual[3].Visible | Should -BeFalse + } } } diff --git a/__tests__/ImportExcelTests/SheetVisibleTesting.xlsx b/__tests__/ImportExcelTests/SheetVisibleTesting.xlsx new file mode 100644 index 0000000..7250907 Binary files /dev/null and b/__tests__/ImportExcelTests/SheetVisibleTesting.xlsx differ diff --git a/changelog.md b/changelog.md index 8f49d34..61d8f1d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,8 +1,9 @@ -# y.y.x +# 7.8.2 - Fix docs [#1254](https://github.com/dfinke/ImportExcel/pull/1251)`Add-Worksheet` warning. Thank you [Wilson Stewart](https://github.com/WilsonStewart) - Fix docs [#1251](https://github.com/dfinke/ImportExcel/pull/1251)`Add-Worksheet` warning. Thank you [Jeremiah Adams](https://github.com/JeremiahTheFirst) - Fix docs [#1253](https://github.com/dfinke/ImportExcel/pull/1253) `convertfrom-exceltosqlinsert`. Thank you [Wes Stahler](https://github.com/stahler) +- Extended Get-ExcelFileSummary to include more Visible -eq $true|$false # 7.8.1