mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-24 04:04:46 +00:00
fix naming consitency (case mostly)
This commit is contained in:
28
ExportedCommands/Remove-Worksheet.ps1
Normal file
28
ExportedCommands/Remove-Worksheet.ps1
Normal file
@@ -0,0 +1,28 @@
|
||||
Function Remove-Worksheet {
|
||||
[cmdletbinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
# [Parameter(ValueFromPipelineByPropertyName)]
|
||||
[Parameter(ValueFromPipelineByPropertyName)]
|
||||
[Alias('Path')]
|
||||
$FullName,
|
||||
[String[]]$WorksheetName = "Sheet1",
|
||||
[Switch]$Show
|
||||
)
|
||||
|
||||
Process {
|
||||
if (!$FullName) {
|
||||
throw "Remove-Worksheet requires the and Excel file"
|
||||
}
|
||||
|
||||
$pkg = Open-ExcelPackage -Path $FullName
|
||||
|
||||
if ($pkg) {
|
||||
foreach ($wsn in $WorksheetName) {
|
||||
if ($PSCmdlet.ShouldProcess($FullName,"Remove Sheet $wsn")) {
|
||||
$pkg.Workbook.Worksheets.Delete($wsn)
|
||||
}
|
||||
}
|
||||
Close-ExcelPackage -ExcelPackage $pkg -Show:$Show
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user