ruby - How do I open a new XLSX file in roo? -


this code:

newbook = roo::excelx.new('./test.xlsx') 

gives me error:

c:/ruby193/lib/ruby/gems/1.9.1/gems/roo-1.13.2/lib/roo/excelx.rb:85:in `block in initialize': file ./test.xlsx not exist (ioerror) 

why? how make new xlsx file ruby's roo gem?

roo meant reading excel files only. recommend axlsx gem.

it can used in pure ruby follows

require 'axslx' package = axlsx::package.new workbook = package.workbook workbook.add_worksheet(name: 'some sheet name') |sheet|   sheet.add_row ["header 1", "header 2", "header 3"]   sheet.add_row ["data 1", "data 2", "data 3"] end package.serialize('./test.xlsx') 

this create spreadsheet looks like

 -------------------------------- | header 1 | header 2 | header 3 |  -------------------------------- | data 1   | data 2   | data 3   | 

axlsx offers pretty can in excel including styling , conditional styling. hope helps out.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -