GoogleSheets.Callback behaviour

Behaviour for callbacks when updated has loaded a spreadsheet.

Callbacks

on_loaded/2

Specs:

Called when a new version of a spreadsheet has been loaded, but before it has been saved to ETS.

The main reason for this callback is to transform the raw CSV data into application specific format. For example, you could use ex_csv library to convert the data into a map and return that as the data to store into ETS table.

The data returned can be of any type that can be inserted into ETS table.

on_saved/2

Specs:

  • on_saved(spreadsheet_id :: atom, data :: any) :: any

Called after the data has been persisted to ETS.

The data passed to this function is equal to return value of on_loaded callback.

on_unchanged/1

Specs:

  • on_unchanged(spreadsheet_id :: atom) :: any

Called by the updater process when loader returns :unchanged result.