E
E
eldar_web2015-01-27 18:35:05
Ruby on Rails
eldar_web, 2015-01-27 18:35:05

There is a site on Ruby on Rails, how to load goods into an excel file from a database using ruby ​​(or RoR)?

Let's say there is a link "Download an excel file", and when I click it, I want to add products from the database there and download the file.
Tell me the way or provide examples please how to do it!?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Vsk, 2015-01-27
@eldar_web

In a simple case, you can just render xml: railscasts.com/episodes/362-exporting-csv-and-exce...
For more complex ones (colors, formatting, graphics, cell merging...), there are other solutions besides axlsx:
https://github.com/woahdae/simple_xlsx_reader
https://github.com/harvesthq/simple_xlsx_writer
https://github.com/roo-rb/roo
simple_reader\writer seems to only work with xlsx (no xls), but it seems to be an order of magnitude faster.
Roo is just an alternative, by and large.
In general, rendering for Microsoft Excel is sometimes a fun task, so one gem does something better, something worse: sometimes they choose one or the other.
Plus, do not forget that if there are a lot of products, you may want to create a file on a schedule so that you don’t have to wait for a full upload every time you access it. Or, alternatively, at least cache it.

O
OnYourLips, 2015-01-27
@OnYourLips

Standard, https://github.com/randym/axlsx

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question