talira

Office Open XML Spreadsheet generator for the Ruby programming language

open sourceMITself-hostablefree

Caxlsx (Community Continued Version of Axlsx) writes Excel XLSX files from Ruby with styles, charts, images, formulas, tables, pivot tables, conditional formatting, data validation, merged cells, auto filters, headers and footers and print options, and can validate a workbook against the schema before saving it. Randy Morgan created Axlsx; in 2019 the community forked it and its related gems into the caxlsx GitHub organization to keep them maintained. caxlsx_rails, also listed here, adds an .xlsx.axlsx template handler and renderer to Rails, so spreadsheet code lives in views and mailers. Since 4.0 it escapes formulas by default to prevent formula injection.

Problems it solves

  • let users download a report from my Rails app as a real Excel file, not a CSV
  • generate an XLSX with bold headers, borders, number formats and column widths from Ruby
  • put a pie or bar chart inside the Excel export we email to clients
  • write spreadsheet export code in a view template instead of stuffing it in the controller
  • attach a generated Excel workbook to an email from a Rails mailer
  • a customer's name starting with = turned into a formula in our export
  • make sure the spreadsheet we generate actually opens in Excel before sending it
  • freeze the header row, add auto filters and repeat headers when the sheet is printed
  • add formulas, merged cells and dropdown validation to a generated spreadsheet
  • password-protect a sheet in a workbook my app produces
  • create a pivot table in an Excel file built by a background job
  • insert a company logo image into a generated Excel report
  • columns in our exported spreadsheet are too narrow and nobody can read them

Features

  • 3D pie, line, scatter and bar charts with data labels and series colors
  • cell styles: borders, alignment, fills, fonts and number formats
  • automatic data types for numbers, strings, dates, times and booleans
  • automatic and fixed column widths
  • formulas, merged cells, row and column outlining and data validation
  • tables, auto filters, pivot tables and conditional formatting
  • jpg, gif and png images with hyperlinks
  • headers, footers, page margins, print options and page breaks
  • sheet protection, and workbook encryption with the ooxml_crypt gem
  • schema validation before serialization
View 3 more
  • output to a file or StringIO, with shared or inline strings
  • formula escaping by default against formula injection
  • caxlsx_rails: .xlsx.axlsx templates, partials, mailer attachments and a renderer

Limitations

  • Charts don't render in Apple Numbers, and images don't show in Google Docs: known interoperability issues the README lists1

Capabilities

Has an APIplan not known