wood burning stoves 2.0*
The moose likes Linux / UNIX and the fly likes Excel Macros in UNIX Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Excel Macros in UNIX" Watch "Excel Macros in UNIX" New topic
Author

Excel Macros in UNIX

satya devarapalli
Greenhorn

Joined: Jan 28, 2009
Posts: 9
Hello,

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.

Thanks much!
Satya
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Your question has very little to do with Java, it's mostly about UNIX, so I changed its title and moved it to a better forum.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5830
    
    7

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').


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Excel Macros in UNIX