I need to read and write to Excelx file with ruby code, Tried with spreadsheet it does not support xlsx format, Roo is also to read the file and not write to xlsx.
Is there any gem/plugin which will write to Excelx?
For the task of writing/exporting xlsx files, Axlsx is the most feature complete library I've found. It does not support reading/importing xlsx files, though.
https://github.com/randym/axlsx
Here's the author's description:
xlsx generation with charts, images, automated column width, customizable styles and full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification. Check out the README for some examples of how easy it is. Best of all, you can validate your xlsx file before serialization so you know for sure that anything generated is going to load on your client's machine.
You can try this gem
https://github.com/harvesthq/simple_xlsx_writer
And
https://github.com/cxn03651/writeexcel/
seems RubyXL does both, read AND write https://github.com/gilt/rubyXL haven't used it yet though..
An XLSX file is essentially a zipped collection of XML files. If you don't find suitable gem, you may try generating them manually using Ruby, possibly using an empty template saved from Excel. We used to do that, worked pretty well, unfortunately that code is not open-sourced.
But eventually, we needed more control over how the result looks so we made .NET based solution with Excel automation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With