Any gem or plugins in ruby on rails which will read the data from excel sheet.
Try Spreadsheet GEM. It provides facility to read xls file. You can also try Roo.
Related
I want to convert Excel with multiple sheets and Word files to PDF format as a single file using Ruby.
Is there any Script/Gems/Plugins available to achieve this?
You can use libreconv
https://github.com/ricn/libreconv
You'll need to install libre office on your server, which is straightforward.
There is not a Gem doing all the job. but you can combine some:
For excel files - read data using roo GEM - http://roo.rubyforge.org/
For word files Opening .doc files in Ruby
Convert the data readed in previous steps into html.
Then convert it to pdf using: https://github.com/pdfkit/PDFKit
In my rails application, I need to upload some doc/xls files and parse its structure and get information. How can I get data from *.doc or *.xls in maybe xml format or anything else that I can read and parse?
You can parse different types of spreadsheets using the Roo gem. It supports:
OpenOffice
Excel
Google spreadsheets
Excelx
LibreOffice
CSV
From my experience it has some issues with parsing .xls files, however parsing .xlsx files is good.
As for .doc files, you may try using msworddoc-extractor gem or try one of the solutions proposed here.
Update: working with *.docx files - docx and docx-html
Have you seen the Nokogiri gem? http://nokogiri.org/
Very useful for xml parsing
The spreadsheet gem is nice for excel and csv files.
https://github.com/zdavatz/spreadsheet
I'm a bit frustrated with the gems out there. It seems like each one does one thing well but not others.
roo parses both xlsx and xls however it doesn't seem to read certain fields correctly and isn't working in each case I need it to.
spreadsheet gem doesn't parse xlsx
rubyXL doesn't parse xls files
Any other suggestions?
Thanks
I would just combine the rubyXL gem and the spreadsheet gem if you're happy with the individual results both provide.
I found many have suggested spreadsheet gem in rails for reading excel sheet which is not working with ms office 2007 file(xlsx). And i am not sure it do work for open office file.
so i wish to know will it work for openoffice or any other gem will support all the spreadsheet format.
Its really lot of similar questions here but no great answers for this.
Roo will handle all the spreadsheet formats. But before instaling roo, you will have to install 'nokogiri', 'google-spreadsheet-ruby', 'builder' gems.
Took over an existing Rails 2.3.x app. Need to export some data to xlsx format(Excel 2007).
Unfortunately I cant use plain XLS format as it has a limit of 256 columns per sheet. The data the app exports goes beyond that limit.
Are there any existing gems/plug-ins that can generate XLSX files?
I have google-ed for answers, but nothing worked so far.
I have tried installing simple_xlsx_writer gem, and did the usual gem.config "simple_xlsx_writer" but it kept complaining that it couldn't find the required gem. (e.g. "Missing these required gems: simple_xlsx_writer "). Which is weird as I have it installed.
Looked at roo gem, but it only has the ability read xlsx files. So not good.
Open to any other suggestions so as long as the data can be opening in Excel.
Thanks in advance.
Have you seen the AXLSX Gem? You may have to require you database adapter manually and build the export by still possible. This can an entire workbook sheets, charts, etc. The only caveat I found is that charts cannot be their own sheet.
https://github.com/randym/axlsx