A ruby library to convert an open document spreadsheet file to a hash with keys of each sheet name and stores the data as a CSV in string format
An easy to use ruby library to convert an open document spreadsheet file to a hash with keys of each sheet name and stores the values as a 2D array in string format like a CSV. No Gems to install.
This library was created as a way to import a spreadsheet into SketchUp 2017 with the ruby API.
This library uses “rexml” to read XML files which is extremely slow compared to other libraries like Nokogiri
A 75kb file takes about 5.2s to read and convert
A 9kb file takes about 0.4s to read and convert
require_relative 'path/to/ods-reader/ods-reader'
module ThisEnnsHere
spreadsheet = ODStoCSVarray.new('/path/to/file.ods')
spreadsheet.list # => ['Sheet1', 'Sheet2', ... ]
spreadsheet.has?('Sheet1') # => true
spreadsheet['Sheet1'] # => [['row1 col1','row1 col2', ... ], ['row2 col1','row2 col2', ... ], ... ]
end