Added Copy-ExcelWorksheet

This commit is contained in:
dfinke
2016-07-30 15:11:01 -04:00
parent 372fdc4213
commit 3efdfd0e0b
4 changed files with 29 additions and 2 deletions

22
Copy-ExcelWorkSheet.ps1 Normal file
View File

@@ -0,0 +1,22 @@
function Copy-ExcelWorkSheet {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
$SourceWorkbook,
[Parameter(Mandatory=$true)]
$SourceWorkSheet,
[Parameter(Mandatory=$true)]
$DestinationWorkbook,
$DestinationWorkSheet,
[Switch]$Show
)
Write-Verbose "Copying $($SourceWorkSheet) from $($SourceWorkbook) to $($DestinationWorkSheet) in $($DestinationWorkbook)"
if(!$DestinationWorkSheet) {
$DestinationWorkSheet = $SourceWorkSheet
}
Import-Excel -Path $SourceWorkbook -WorkSheetname $SourceWorkSheet |
Export-Excel -Path $DestinationWorkbook -WorkSheetname $DestinationWorkSheet -Show:$Show
}