# Exceed

`Exceed` is a high-level stream-oriented library for generating Excel files,
useful when generating spreadsheets from data sets large enough that they may
exceed available memory—or the available memory that one wants to dedicate to
building spreadsheets.

## Installation

``` elixir
def deps do
    {:exceed, "~> 0.1"}

## Why a duck?

XLSX files are zip files containing numerous XML files following
OpenXML schemas. [`High-level libraries`]( already
exist to generate XLSX files from Elixir, but do not handle streams—all
content to be written to a spreadsheet must be held in memory until the
spreadsheet is fully written.

[`Low-level libraries`]( already exist to
generate XLSX files from streams, but are so low level that one must know all
the ins and outs of SpreasheetML, including positional ordering of files, tags,
and attributes.

We wanted a library that hides the complexity of streaming to XML to zlib,
and hides the complexity of OOXML.

## Usage

XLSX streams are generated by initializing a workbook (with a creator name),
adding worksheets, and then converting that to a stream.

``` elixir
stream ="Creator Name")
  |> Exceed.Workbook.add_worksheet("Sheet Name", ["Heading 1", "Heading 2"]
      [["Row 1 Cell 1", "Row 1 Cell 2"], ["Row 2 Cell 1", "Row 2 Cell 2"]])

|> Stream.into(!("/tmp/workbook.xslx"))

Worksheets may be initialized with lists of lists, or they may be initialized
with a stream of data that maps to a list of cells.

``` elixir
rows =
  Stream.unfold(1, fn
    10_001 -> nil
    row_count -> {["Row #{row_count} Cell 1", "Row #{row_count} Cell 2"], row_count + 1}
  end)"Sheet Name", ["Heading 1", "Heading 2"], rows)

## Alternatives & References

This library is inspired by and learns from other great libraries. One might
choose to use one of those in place of `Exceed`:

- [`elixlsx`]( - Provides fine-grained control
  over cells, but is not stream-oriented and thus requires that all source data
  and rows be retained in memory until the entire workbook is written.
- [`xlsx_stream`]( - Provides low-level
  constructs that may be combined to make an Excel file. Works nicely with
  streams. Requires that one know all the ins and outs of
  in order to make a valid file that Excel can parse.

## Contributing

This library uses [`medic`]( for its
development workflow.

``` shell
brew bundle


If one does not want to install extra tooling but wishes to contribute code
fixes, new features, or documentation, please verify that code is formatted
with the versions of Elixir and Erlang specified in `.tool-versions`, passes
all tests, and passes strict credo and dialyzer.