dfinke / ImportExcel

PowerShell module to import/export Excel spreadsheets, without Excel

Home Page:https://www.powershellgallery.com/packages/ImportExcel/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Close-ExcelPackage -Show broken on MacOS due to PowerShell issue

pccasto opened this issue · comments

This is just informational for this project.

Close-ExcelPackage with -Show results in
Start-Process: An error occurred trying to start process </dir/file> with working directory '</workdir>'. Permission denied

Line 36 in Close-ExcelPackage
if ($Show) { Start-Process -FilePath $SaveAs }

Seems to run afoul of a PowerShell bug:
PowerShell/PowerShell#20990
That bug was reported against 7.4.0, but I experienced it on 7.3.3 as well.

It is possible to patch Close-Excel package to do something like this:

$SaveAsObj = gci $SaveAs
Start-Process -FilePath  $SaveAsObj.Name   -WorkingDirectory $SaveAsObj.DirectoryName

Not suggesting this as a change to the source, but if anyone else is faced with this problem, this may help.

@pccasto Thanks for issue and workaround