Skip to content

xou/elixlsx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d24fa38 · Aug 7, 2024
Jan 29, 2024
Jun 4, 2024
Aug 7, 2024
Jun 4, 2024
Sep 26, 2019
Feb 9, 2021
Aug 29, 2021
Jan 29, 2024
Nov 24, 2015
Jan 29, 2024
Jul 3, 2023
Feb 8, 2024
Jun 4, 2024

Repository files navigation

Elixlsx

Build Status Module Version Hex Docs Total Download License Last Updated

Elixlsx is a writer for the MS Excel OpenXML format (.xlsx).

Features:

  • Multiple (named) sheets with custom column widths & column heights.
  • (Unicode-)strings, Numbers, Dates
  • Font formatting (size, bold, italic, underline, strike)
  • Horizontal alignment and text wrapping
  • Font and cell background color, borders
  • Merged cells

Installation

As of version 0.6, elixlsx requires Elixir 1.12 or above.

Installation via Hex, in mix.exs:

defp deps do
  [{:elixlsx, "~> 0.6.0"}]
end

Via GitHub:

defp deps do
  [{:elixlsx, github: "xou/elixlsx"}]
end

Usage

1-Line tutorial:

(alias Elixlsx.Workbook, alias Elixlsx.Sheet)
iex(1)> Workbook.append_sheet(%Workbook{}, Sheet.with_name("Sheet 1") |> Sheet.set_cell("A1", "Hello", bold: true)) |> Elixlsx.write_to("hello.xlsx")

See example.exs for examples how to use the various features.

  • The workbook is a XML file ultimately, so remember that formulas containing "<" or ">" must be escaped properly.
  • :xmerl_lib.export_text/1 can be used to escape formulas properly

Number and date formatting reference

A quick introduction how number formattings look like can be found here.

License

Copyright (c) 2015 Nikolai Weh

This library is MIT licensed. See the LICENSE for details.