Vijay Dev
Vijay Dev

Reputation: 27476

How to create a spreadsheet with formulas using Rails?

I need some gem/plugin to create an Excel spreadsheet with formulas to use in my Rails application. Any suggestions?

Upvotes: 3

Views: 4573

Answers (4)

Vijay Dev
Vijay Dev

Reputation: 27476

writeexcel does it wonderfully!

Upvotes: 1

squarism
squarism

Reputation: 3307

I've used Roo and it's quite good and easy to do spreadsheet processing (once you get all the gem dependencies installed). However, it doesn't support formulas natively. It won't eval the formula and return the result (this would be difficult I think -- use the excel engine?) but it will give you the text of the formula, for example:

=SUM(.A1,.B1)

It'd be pretty easy to handle this specific case but if you have many different formulas and functions then rolling your own evaluator is going to be difficult. Going and getting A1 and B1 to add them together is very doable with Roo. It's just a question of how complex your formulas are.

Upvotes: 1

fl00r
fl00r

Reputation: 83680

I think you should create blank Excel file with formulas and then fill it with Rails. Because you can't create formulas with Ruby.

Upvotes: 0

Caley Woods
Caley Woods

Reputation: 4737

There's a spreadsheet gem listed on RubyGems but having never used it I can't recommend it.

Upvotes: -1

Related Questions