Minimalist ODS

minimalist_ods is a minimalist gem for generating ODS (Open Document Spreadsheet) files in Ruby. This gem is designed specifically for exporting data to ODS format.

Installation

Add this line to your Gemfile:

gem 'minimalist_ods'

And then execute:

bundle install

Or install it yourself as:

gem install minimalist_ods

Usage

Create an ODS File

To create an ODS file, first initialize an ODS object with the file name and the creator's name:

require 'minimalist_ods'

# by default, creator metadata will be minimalist-ods, you can set it as the second argument in your constructor
ods = MinimalistODS.new('example.ods', 'Creator')

Open a Table

To add a table, use the open_table method with the table name and the number of columns:

ods.open_table('Sheet1', 3)

Add Rows

To add a row, use the add_row method with an array of values:

ods.add_row(['Name', 'Age', 'City'])
ods.add_row(['Alice', 30, 'New York'])
ods.add_row(['Bob', 25, 'San Francisco'])

Close the Table

Once you have finished adding rows, close the table using:

ods.close_table

Close the File

Finally, close the file to save the changes:

ods.close_file

Complete Example

require 'minimalist_ods'

ods = MinimalistODS.new('example.ods', 'Your Name')
ods.open_table('Sheet1', 3)
ods.add_row(['Name', 'Age', 'City'])
ods.add_row(['Alice', 30, 'New York'])
ods.add_row(['Bob', 25, 'San Francisco'])
ods.close_table
ods.close_file

Contributions

Contributions are welcome. Please open an issue or a pull request on the GitHub repository.

License

This gem is available as open source under the terms of the MIT License.