diff --git a/.gitignore b/.gitignore index ff3b9cb..2c267d6 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,4 @@ ImportExcel-Copy.psm1 TryCCFmt.ps1 test.xlsx testCCFMT.ps1 +testHide.ps1 diff --git a/Export-Excel.ps1 b/Export-Excel.ps1 index 9cacea3..1d7c982 100644 --- a/Export-Excel.ps1 +++ b/Export-Excel.ps1 @@ -39,7 +39,8 @@ function Export-Excel { [Switch]$BoldTopRow, [string]$RangeName, [string]$TableName, - [Object[]]$ConditionalFormat + [Object[]]$ConditionalFormat, + [string[]]$HideSheet ) Begin { @@ -199,6 +200,10 @@ function Export-Excel { #$pkg.Workbook.View.ActiveTab = $ws.SheetID + foreach($Sheet in $HideSheet) { + $pkg.Workbook.WorkSheets[$Sheet].Hidden="Hidden" + } + $pkg.Save() $pkg.Dispose() diff --git a/ImportExcel.psd1 b/ImportExcel.psd1 index 3524e7b..f0f0564 100644 --- a/ImportExcel.psd1 +++ b/ImportExcel.psd1 @@ -4,7 +4,7 @@ RootModule = 'ImportExcel.psm1' # Version number of this module. -ModuleVersion = '1.7' +ModuleVersion = '1.8' # ID used to uniquely identify this module GUID = '60dd4136-feff-401a-ba27-a84458c57ede' diff --git a/PublishToGallery.ps1 b/PublishToGallery.ps1 index e9f7d9f..3621e5e 100644 --- a/PublishToGallery.ps1 +++ b/PublishToGallery.ps1 @@ -4,7 +4,7 @@ $p = @{ NuGetApiKey = $NuGetApiKey LicenseUri = "https://github.com/dfinke/ImportExcel/blob/master/LICENSE.txt" Tag = "Excel","EPPlus","Export","Import" - ReleaseNote = "Apply conditional format icons to toc cells in your data" + ReleaseNote = "Now you can hide worksheets using the -HideSheet paramater" ProjectUri = "https://github.com/dfinke/ImportExcel" } diff --git a/README.md b/README.md index 74de587..ce1ada3 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,31 @@ Know Issues What's new - -#### 9/11/2015 5:37:21 PM + +#### 9/25/2015 + +**Hide worksheets** +Got a great request from [forensicsguy20012004](https://github.com/forensicsguy20012004) to hide worksheets. You create a few pivotables, generate charts and then pivotable worksheets don't need to be visible. + +`Export-Excel` now has a `-HideSheet` parameter that takes and array of worksheet names and hides them. + +##### Example +Here, you create four worksheets named `PM`,`Handles`,`Services` and `Files`. + +The last line creates the `Files` sheet and then hides the `Handles`,`Services` + + $p = Get-Process + + $p|select company, pm | Export-Excel $xlFile -WorkSheetname PM + $p|select company, handles| Export-Excel $xlFile -WorkSheetname Handles + Get-Service| Export-Excel $xlFile -WorkSheetname Services + + dir -File | Export-Excel $xlFile -WorkSheetname Files -Show -HideSheet Handles, Services + + +**Note** There is a bug in EPPlus that does not let you hide the first worksheet created. Hopefully it'll resolved soon. + +#### 9/11/2015 Added Conditional formatting. See [TryConditional.ps1](https://github.com/dfinke/ImportExcel/blob/master/TryConditional.ps1) as an example.