diff --git a/Copy-ExcelWorkSheet.ps1 b/Copy-ExcelWorkSheet.ps1 new file mode 100644 index 0000000..87503e4 --- /dev/null +++ b/Copy-ExcelWorkSheet.ps1 @@ -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 +} \ No newline at end of file diff --git a/Install.ps1 b/Install.ps1 index 3ed502e..e5fa13c 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -21,6 +21,7 @@ $fileList = echo ` Get-ExcelSheetInfo.ps1 ` Get-Range.ps1 ` TrackingUtils.ps1 ` + Copy-ExcelWorkSheet.ps1 ` plot.ps1 if ('' -eq $InstallDirectory) diff --git a/InstallModule.ps1 b/InstallModule.ps1 index 09fae43..7458ce0 100644 --- a/InstallModule.ps1 +++ b/InstallModule.ps1 @@ -25,9 +25,10 @@ $targetFiles = echo ` Import-Html.ps1 ` Get-Range.ps1 ` TrackingUtils.ps1 ` + Copy-ExcelWorkSheet.ps1 ` plot.ps1 - -ls $targetFiles | + +ls $targetFiles | ForEach { Copy-Item -Verbose -Path $_.FullName -Destination "$($TargetPath)\$($_.name)" } \ No newline at end of file diff --git a/README.md b/README.md index 436c84c..2855fa5 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,9 @@ iex (new-object System.Net.WebClient).DownloadString('https://raw.github.com/dfi # What's new +#### 7/30/2016 +* Added `Copy-ExcelWorksheet`. Let's you copy a work sheet from one Excel workbook to another. + #### 7/21/2016 * Fixes `Import-Excel` #68