views:

121

answers:

1

I am tasked to develop a very simple web layer for a very complex algorithm that is implemented as an Excel worksheet. This script would be called from a Ruby on Rails app that would be presenting the user with the forms, check validations and whatnot, and should return just a number. After perusing this site, my best shot is to automate Excel using Python or Ruby under Windows and run the algorithm there --we are a Ruby shop, but I've found more info for Python.

I think I can write a Python script to run the calculation in a day, but now the final question remains: how do we put a web layer on top of the core script? We are familiar with Apache, so installing Python as a Apache module is my straight thought, but we could also install Twisted and try to run the web server itself in Python.

What would be your choices?

+1  A: 

My first choice would be to move the calculations that are in the Excel workbook into my Ruby application code. While it will likely take some additional work, my guess is that it will take less time to port the Excel app to Ruby than introducing layers of complexity on top of Excel. Additionally, calling into Excel, passing user submitted data, opens up additional possible security holes.

My second choice would be to do it the language you know best. It looks like Ruby can interact with Excel using win32ole (another example).

John Paulett
Agreed about the comment on moving the calculations outside of Excel, if this is an option. First, this should give you something testable, and easier to work with. Then, I haven't worked with Excel through either Ruby or Python, but I have used Microsoft interop, and it's very easy to get leaks. I don't know where the Excel instance would be sitting, but if it is on a server, think twice!
Mathias