[Powershell Commander] Unable to create/access local files with PowerShell Commander

Forge Component
(10)
Published on 2017-01-07 by Danny Prager
10 votes
Published on 2017-01-07 by Danny Prager

Hi,

I'm trying to create a new Excel file from an OutSystems button action, using the below code:

However, nothing happens when the action is run from the Front-End. 

I've also tried saving a newly created Excel file locally, but nothing happens again.

What could be causing these issues?

Thanks for your help.

Powershell commander runs on the server. When creating an Excell, the Excell application should also be availeble on the server. 

Since it is compiled in .NET it does not run in your browser. What you could to is create a txt file as csv and then download it on the client (thus opening it in Excel) or save a json string to a txt file end the use the standard outsystems functionality to convert it to excel. If you have Excel installed on the server.. this should work. (runs on my machine)

$excel = New-Object -ComObject excel.application
$excel.visible = $True
$workbook = $excel.Workbooks.Add()
$workbook.SaveAs('C:\temp\MyNewExcel.xlsx')
$excel.Quit()


Isn't it better, in this particular case, to use a more dedicated component like Advanced Excel? Using specialized component for these kind of actions gets you on track a lot quicker then trying to create your own methods or applying scripts that you used on your own machine (with all needed software already installed). 

This method will also not work when your using the hosted solution of OutSystems since installing additional software (like Excel) is prohibited on the frond-end servers.