Spreadsheet files, with clear boundaries.
Read and write a documented subset of XLSX and ODS in Ruby. Lesath preserves supported cells and rejects features it cannot keep intact.
CRuby 3.2 or newer. Available on RubyGems.
| Item | Amount |
|---|---|
| Tea | 12.50 |
| Coffee | 8.00 |
| Water | 4.25 |
Predictable by design.
Interchange without quietly changing the workbook you meant to keep.
Keep the essentials
Multiple ordered sheets, sparse cells, strings, finite numbers, and booleans.
Know what is unsupported
Styles, charts, merged cells, and other unsupported features fail on import rather than disappear.
Handle formulas honestly
Store formula text and a cached value in the same format. Lesath does not calculate or translate formulas.
Write your first workbook.
Install the gem, create a sheet, and read back its cells. Coordinates start at 1. Choose a new filename each time you export.
gem install lesath
Follow the getting started guide
require "lesath"
book = Lesath::Workbook.new.add_sheet("Sales")
book.set("Sales", 1, 1, "Item")
book.set("Sales", 1, 2, "Amount")
book.set("Sales", 2, 1, "Tea")
book.set("Sales", 2, 2, 12.5)
Lesath.write(book, "sales.xlsx")
copy = Lesath.read("sales.xlsx")
copy.cell("Sales", 2, 2).value # => 12.5
Lesath.write(copy, "sales.ods")
Supported scalar cells can move between formats. Formula text stays in its original format and is never calculated.