diff --git a/.gitignore b/.gitignore index 21fb51f..65d2833 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,5 @@ InstallModule.ps1 Export-Excel.ps1 testExport.xlsx test.ps1 +testPwd.xlsx +test.csv diff --git a/ImportExcel.psm1 b/ImportExcel.psm1 index fc0867a..f583df2 100644 --- a/ImportExcel.psm1 +++ b/ImportExcel.psm1 @@ -53,6 +53,7 @@ function Export-Excel { [string[]]$PivotRows, [string[]]$PivotColumns, [string[]]$PivotData, + [string]$Password, [OfficeOpenXml.Drawing.Chart.eChartType]$ChartType="Pie", [Switch]$IncludePivotTable, [Switch]$IncludePivotChart, @@ -137,6 +138,7 @@ function Export-Excel { } } + $ws.Protection.SetPassword($Password) $pkg.Save() $pkg.Dispose() @@ -151,6 +153,7 @@ function Export-MultipleExcelSheets { $Path, [Parameter(Mandatory)] [hashtable]$InfoMap, + [string]$Password, [Switch]$Show, [Switch]$AutoSize )