xlsx-tabular-0.1.1: Xlsx table decode utility

Safe HaskellNone
LanguageHaskell2010

Codec.Xlsx.Util.Tabular

Contents

Description

Convenience utility to read Xlsx tabular cells.

The majority of the toTableRows* functions assume that the table of interest consiste of contiguous rows styled with borders lines surrounding all cells, with possible text above and below the table that is not of interest. Like so:

Some documentation here....
---------------------------
| Header1 | Header2 | ... |
---------------------------
| Value1  | Value2  | ... |
---------------------------
| Value1  | Value2  | ... |
---------------------------
Maybe some annoying text here, I don't care about.

The heauristic used for table row selection in these functions is that any table rows will have a bottom border line.

If the above heuristic is not valid for your table you can instead provide your own row selection predicate to the toTableRowsCustom function. For example, the predicate \_ _ -> True (or (const . const) True) will select all contiguous rows.

Synopsis

Types

data Tabular Source #

Tabular cells

Lenses

Tabular

TabularHead

TabularRow

Methods

def :: Default a => a #

The default value for this type.

Functions

toTableRowsFromFile Source #

Arguments

:: Int

Starting row index (header row)

-> String

File name

-> IO (Maybe Tabular) 

Read tabular rows from the first sheel of an Xlsx file. The table is assumed to consist of all contiguous rows that have bottom border lines, starting with the header.

toTableRows Source #

Arguments

:: Xlsx

Xlsx Workbook

-> Text

Worksheet name to decode

-> Int

Starting row index (header row)

-> Maybe Tabular 

Decode cells as tabular rows. The table is assumed to consist of all contiguous rows that have bottom border lines, starting with the header.

toTableRows' Source #

Arguments

:: Xlsx

Xlsx Workbook

-> Int

Starting row index (header row)

-> Maybe Tabular 

Decode cells from first sheet as tabular rows. The table is assumed to consist of all contiguous rows that have bottom border lines, starting with the header.

Custom row predicates

toTableRowsCustom Source #

Arguments

:: (StyleSheet -> (Int, [(Int, Cell)]) -> Bool)

Predicate for row selection

-> Xlsx

Xlsx Workbook

-> Text

Worksheet name to decode

-> Int

Starting row index (header row)

-> Maybe Tabular 

Decode cells as tabular rows. The table is assumed to consist of all contiguous rows that fulfill the given predicate, starting with the header.

The predicate function is given the Xlsx StyleSheet as well as a row (consisting of the row's index and the row's cells) and should return True if the row is part of the table.