I have few calculations done in excel sheets using macros. Now, I would like to invoke those macros through Java and get the results back.
I found this solution for invokation,
Runtime.getRuntime().exec("cmd /c start calling.vbs");
This command looks like it will work for windows environment. The environment I will be running my java application is UNIX based, how should I invoke my excel macros ?
Let me know if there are other options.
Do you want to invoke the Excel macros with Excel running on Linux? Or do you want to, from a Linux machine, invoke a macro in Excel running on a Windows machine?
If the former, you will need to first install Excel on Linux. I haven't tried this, but supposedly using Wine you can get MS Office running on Linux. Good luck with that. And once you do that, you have to figure out how to invoke a macro - you can't do it using a VB script, though (at least, not as far as I know).
If the latter, you might have to set up a service on the Windows machine that will receive the request. A web service should do the trick.
As alternatives, have you thought of:
a) Converting the calculation into R? R runs on both Windows and Linux and is easy to invoke from Java in both cases.
b) Have you looked into converting the Excel macro to a Libre Office Calc macro? Calc might be able to automatically convert the macro. Invoking Calc from Linux would be simpler than getting Office to run within Wine.
Personally, I would dump Excel and use R (option 'a').