mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-14 23:33:18 +00:00
Add code to do removal
This commit is contained in:
@@ -1,2 +1,19 @@
|
|||||||
Function Remove-WorkSheet {
|
Function Remove-WorkSheet {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory)]
|
||||||
|
$Path,
|
||||||
|
[Parameter(Mandatory)]
|
||||||
|
[String[]]$WorksheetName,
|
||||||
|
[Switch]$Show
|
||||||
|
)
|
||||||
|
|
||||||
|
$pkg = Open-ExcelPackage -Path $Path
|
||||||
|
|
||||||
|
if ($pkg) {
|
||||||
|
foreach ($wsn in $WorksheetName) {
|
||||||
|
$pkg.Workbook.Worksheets.Delete($wsn)
|
||||||
|
}
|
||||||
|
|
||||||
|
Close-ExcelPackage -ExcelPackage $pkg -Show:$Show
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user