io.github.quafadas.scautable

Members list

Type members

Classlikes

class BadTableException(message: String) extends Exception

Exception thrown when there are issues with Excel table structure

Exception thrown when there are issues with Excel table structure

Attributes

Supertypes
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
object CSV

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
CSV.type

Extension methods for writing NamedTuple collections to CSV format.

Extension methods for writing NamedTuple collections to CSV format.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
trait CellFormat[A]

How a single cell's value is rendered as text.

How a single cell's value is rendered as text.

Invariant: an instance is found by exact type match, so a tagged column (see ColumnFormat) resolves its own instance while an untagged column of the same underlying type falls back to toString.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object CellFormat

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
CellFormat.type
object ColumnFormat

Display tags for table columns.

Display tags for table columns.

Each tag is a bounded opaque type over the value it decorates - e.g. Decimals[2] is a Double at runtime and erases to one, but is a distinct type to the compiler. That gives us three things at once:

  • a given CellFormat[Decimals[2]] can be found for it, so the column renders differently from a plain Double sitting next to it;
  • the bound (` f"$$$d%,.2f" }}}

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object ColumnTyped

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object ConsoleFormat

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
class CsvIterator[K <: Tuple, V <: Tuple] extends Iterator[NamedTuple[K, V]], AutoCloseable

A NamedTuple representation of a CSV file.

A NamedTuple representation of a CSV file.

It is a (lazy) iterator that reads a CSV file line by line and converts each line into a NamedTuple.

Attempting to use the iterator a second time will throw a StreamClosedException. Common usage

def csvIterator = CSV.resource("simple.csv")
val csvData = csvIterator.toSeq

It owns the file handle it reads from, and releases it when the rows run out - so the shape above needs no cleanup. If you stop reading early, close it yourself, or wrap it in scala.util.Using; see close.

Note that at this point, you are plugged right into the scala collections API.

csvData.filter(_.column("colA") == "foo").drop(10).take(5).map(_.column("colB"))

etc

Attributes

Supertypes
trait AutoCloseable
trait Iterator[NamedTuple[K, V]]
trait IterableOnceOps[NamedTuple[K, V], Iterator, Iterator[NamedTuple[K, V]]]
trait IterableOnce[NamedTuple[K, V]]
class Object
trait Matchable
class Any
Show all
case class CsvOpts(headerOptions: HeaderOptions = ..., typeInferrer: TypeInferrer = ..., delimiter: Char = ..., readAs: ReadAs = ...)

Configuration options for reading CSV files.

Configuration options for reading CSV files.

Value parameters

delimiter

The character used to separate fields (default: comma)

headerOptions

How to handle headers when reading the CSV

readAs

Whether to read as rows (iterator) or columns (arrays)

typeInferrer

How to infer types for columns

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object CsvOpts

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
CsvOpts.type
trait Decoder[T]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Decoder

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Decoder.type
object Excel

Main Excel API object providing transparent inline methods for reading Excel files

Main Excel API object providing transparent inline methods for reading Excel files

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Excel.type
object ExcelDecoders

Excel-specific decoders that can handle numeric strings like "1.0" These decoders are designed to work with Excel's tendency to format integers as doubles (e.g., "1.0" instead of "1")

Excel-specific decoders that can handle numeric strings like "1.0" These decoders are designed to work with Excel's tendency to format integers as doubles (e.g., "1.0" instead of "1")

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
class ExcelIterator[K <: Tuple, V <: Tuple](filePath: String, sheetName: String, colRange: Option[String])(using decoder: RowDecoder[V]) extends Iterator[NamedTuple[K, V]]

Iterator for reading Excel files with compile-time type safety

Iterator for reading Excel files with compile-time type safety

Type parameters

K

Tuple type representing column names

V

Tuple type representing column value types

Value parameters

colRange

Optional cell range specification (e.g., "A1:C10")

decoder

Row decoder for converting string data to typed tuples

filePath

Path to the Excel file

sheetName

Name of the Excel sheet to read

Attributes

Supertypes
trait Iterator[NamedTuple[K, V]]
trait IterableOnceOps[NamedTuple[K, V], Iterator, Iterator[NamedTuple[K, V]]]
trait IterableOnce[NamedTuple[K, V]]
class Object
trait Matchable
class Any
Show all
object ExcelMacros

Compile-time macro functions for reading val initial = ColumnTypeInfo() val finalInfo = cells.foldLeft(initial)(updateTypeInfo) files These macros perform Excel file inspection at compile time to determine structure

Compile-time macro functions for reading val initial = ColumnTypeInfo() val finalInfo = cells.foldLeft(initial)(updateTypeInfo) files These macros perform Excel file inspection at compile time to determine structure

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class ExcelOpts(range: String = ..., typeInferrer: TypeInferrer = ..., skipFooter: Int = ...)

Configuration options for reading Excel sheets.

Configuration options for reading Excel sheets.

The plain entry points take a range and a type inferrer positionally, which covers most reading. Reach for this when you need an option they do not expose - currently skipFooter.

Value parameters

range

Cell range, empty string reads the whole sheet. Either fully specified ("A1:C10"), or a top left anchor whose open edges are discovered at compile time - "A1" infers both edges, "A1:C" pins the columns, "A1:10" pins the rows

skipFooter

Rows to drop from the bottom of the range before anything else happens, including type inference. The escape hatch for a totals row or a source note that sits directly under the data with no blank row to separate it from the table

typeInferrer

How to infer types for columns

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ExcelOpts

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
ExcelOpts.type
object ExcelRange

Resolution of a table's extent on a sheet, from a top left anchor.

Resolution of a table's extent on a sheet, from a top left anchor.

A range may be given in full ("B5:Q55"), or as an anchor whose open ends are discovered by walking the sheet the way ctrl-right and ctrl-down walk it in Excel:

  • "B5" - anchor only. Both the right and bottom edges are discovered.
  • "B5:Q" - the columns are pinned to B..Q, the bottom edge is discovered.
  • "B5:55" - the rows are pinned to 5..55, the right edge is discovered.

Discovery happens at compile time, so the iterator that is generated carries a fully resolved range and does no scanning at runtime.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
ExcelRange.type

Utility object for managing Excel workbook resources and lifecycle

Utility object for managing Excel workbook resources and lifecycle

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object ExcelUtils

Common utilities and exceptions for Excel processing

Common utilities and exceptions for Excel processing

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
ExcelUtils.type

Thread-safe cache for Excel workbook instances to avoid file contention and improve performance.

Thread-safe cache for Excel workbook instances to avoid file contention and improve performance.

This cache uses weak references to allow workbooks to be garbage collected when no longer needed, while providing significant performance improvements when multiple operations access the same Excel file.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object HtmlRenderer

This is a simple library to render a scala case class as an html table. It assumes the presence of a HtmlTableRender instance for each type in the case class.

This is a simple library to render a scala case class as an html table. It assumes the presence of a HtmlTableRender instance for each type in the case class.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object Stats

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Stats.type
case class TableRow(cells: Seq[String])

A single row of a TerminalTable, i.e. one cell of text per column.

A single row of a TerminalTable, i.e. one cell of text per column.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object TerminalTable

A width-aware terminal table renderer.

A width-aware terminal table renderer.

Unlike ConsoleFormat, which always renders every cell at its natural width (and can therefore overflow arbitrarily wide terminals), TerminalTable shrinks columns to fit the detected (or supplied) terminal width, truncating overflowing cell content with an ellipsis (…) rather than wrapping it onto additional lines.

Width calculations use String#length (UTF-16 code units), not code-point-aware display width - correctness for wide (CJK) or zero-width/combining characters is not guaranteed, only that such content will not crash rendering.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type