Append parameter not working
I am running a simple script with append but it doesn't seems to work. I believe the Append issue is not completely fixed yet? SCRIPT:
'1'| export-excel "C:\powershell\t.xlsx" -WorkSheetname 'SheetName' -StartColumn 1 -Append
'2'| export-excel "C:\powershell\t.xlsx" -WorkSheetname 'SheetName' -StartColumn 1 -Append
""| export-excel "C:\powershell\t.xlsx" -WorkSheetname 'SheetName'
'3'| export-excel "C:\powershell\t.xlsx" -WorkSheetname 'SheetName' -StartColumn 1 -Append
'4'| export-excel "C:\powershell\t.xlsx" -WorkSheetname 'SheetName' -StartColumn 1 -Append
ERROR:
Failed exporting worksheet 'SheetName' to 'C:\powershell\t.xlsx': The property 'Value' cannot be found on this object. Verify that the property exists and
can be set.
At C:\Program Files\WindowsPowerShell\Modules\ImportExcel\5.0.0\Export-Excel.ps1:661 char:17
+ ... throw "Failed exporting worksheet '$WorkSheetname' to '$P ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Failed exportin...and can be set.:String) [], RuntimeException
+ FullyQualifiedErrorId : Failed exporting worksheet 'SheetName' to 'C:\powershell\t.xlsx': The property 'Value' cannot be found on this object. Verify
that the property exists and can be set.
Been having this issue for a while now so I decided to spend a few hours tracking down the problem. I tested it and it will now create files when using -Append and function normally otherwise. Hopefully my fix is adequate!
When I first added -Append it was only intended to work with an existing file,; but I've go a change on the way - basically it now ignores the append switch if the sheet is empty.
This changed will override https://github.com/dfinke/ImportExcel/pull/360