Files
ImportExcel/Examples/AddWorkSheet/AddWorkSheet.ps1
2018-07-15 10:43:02 -04:00

12 lines
351 B
PowerShell

try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
$xlSourcefile = "$env:TEMP\Source.xlsx"
Remove-Item $xlSourcefile -ErrorAction Ignore
$excel = 1..10 | Export-Excel $xlSourcefile -PassThru
Add-WorkSheet -ExcelPackage $excel -WorkSheetname "NewSheet" -CopySource $excel.Workbook.Worksheets["Sheet1"]
Close-ExcelPackage -ExcelPackage $excel -Show