Hello,
I need to call an Excel macro from Talend. In order to do that I wrapped my commands in PowerShell script which I can call either from powershell or cmd.
Example below runs fine:
C:\ETL_Talend\macros>cmd /c powershell C:\ETL_Talend\macros\Talend_run_Excel_macro.ps1
However, when I run the same line from Talend's component tSystem I get an error:
***************
Starting job CallExcelMacro at 15:39 08/02/2011.
'powershell' is not recognized as an internal or external command,
operable program or batch file.
connecting to socket on port 3443
connected
disconnected
Job CallExcelMacro ended at 15:39 08/02/2011.
***************
Please help.
Thanks,
Peter.
Hi
Try to add the path of powershell command to system variable PATH or specify the path of powershell command via 'use home directory'.
Best regards
Shong
Thank you Shong.
I added a path to powershell to my system PATH env. variable - I no longer get error I mentioned.
However, job making a call never complets. Only after I kill Talend job Excel macro really runs and does what I expect.
Please help.
Thank you,
Peter.
Hi
I am not family with Excel macro, there should be a problem in powershell script, maybe emaxt6 can help you. I will notify this post to him.
Best regards
Shong
Hi
There is a problem while executing batch file through Java. If there are multiple line in the batch file, the program just go on and on. It never stops.
You can test this by writing a simple Java program and calling a batch file.
This is not an issue of Talend I have experienced this issue with Java programs although never tried in Talend.
Yes, I close everything and make sure that Excel process is not running. There isknown problem with Excel process not being properly stopped by powershell, I take care of that by simply killing it. Here is my powershell script content:
***********************************
# $excel = new-object -comobject excel.application
$excel = new-object -com Excel.Application
$workbook = $excel.workbooks.open("C:\ETL_Talend\macros\IRI\Test.xlsm")
$excel.Run("TestMacro")
$workbook.Save()
$workbook.Close()
$excel.Quit()
::ReleaseComObject($excel)
Remove-Variable excel
Stop-Process -name EXCEL
*********************************
But it seems the problem is not with Excel macro but with how Talend interacts with Powershell. I wrote a simple powershell script which just executes a few powershell commands - I bump into the same problem - Talend job never exits.