Which spreadsheet, and which backend reaches it.
A workbook is the value every impure function takes and gives back. It names a backend module, holds whatever that backend needs to find the spreadsheet, and remembers the sheets it has.
iex> workbook = Sheetshow.Workbook.memory(["Costs"])
iex> workbook.backend
Sheetshow.Memory.Backend
iex> Map.keys(workbook.sheets)
["Costs"]sheets maps each sheet's title to whatever the backend calls it: the number
Google knows it by, nil where the backend has no name of its own.
Sheetshow.plan/2 wants the keys for :existing_sheets, and the Google wire
format needs the values to address a cell.
ref is the backend's own handle: a Sheetshow.Client for Google, a
Sheetshow.Memory for the in-memory backend. meta is the backend's
scratch, and both of the backends here leave it empty.
Summary
Functions
A workbook over one Google spreadsheet.
A workbook over a Sheetshow.Memory: the spreadsheet that needs no network.
The sheet titles the workbook knows about, sorted.
A workbook over an .xlsx file.
Types
Functions
@spec google(String.t() | Sheetshow.Client.t(), keyword()) :: t()
A workbook over one Google spreadsheet.
Takes a spreadsheet id and the options Sheetshow.Client.new/2 takes, or a
client you have already built, which carries its options already, so none
are taken with it. It knows no sheets until Sheetshow.connect/1.
iex> workbook = Sheetshow.Workbook.google("1AbC")
iex> workbook.ref.spreadsheet_id
"1AbC"
iex> workbook.sheets
%{}
@spec memory(Sheetshow.Memory.t() | [String.t()]) :: t()
A workbook over a Sheetshow.Memory: the spreadsheet that needs no network.
Takes the titles of the sheets to start with, or a memory you already hold.
iex> Sheetshow.Workbook.memory() |> Sheetshow.Workbook.titles()
[]
The sheet titles the workbook knows about, sorted.
iex> Sheetshow.Workbook.memory(["log", "Costs"]) |> Sheetshow.Workbook.titles()
["Costs", "log"]
@spec xlsx(Path.t() | Sheetshow.Store.t(), keyword()) :: t()
A workbook over an .xlsx file.
Takes a path, or a Sheetshow.Store saying where the file is and how to
reach it. create: true says a file that is not there yet is an empty
workbook to be written rather than a mistake.
iex> workbook = Sheetshow.Workbook.xlsx("costs.xlsx")
iex> {workbook.backend, workbook.ref.location}
{Sheetshow.Xlsx.Backend, "costs.xlsx"}