GoogleSheets.Loader behaviour

Behaviour for a spreadsheet loader.

Each module implementing this behaviour is expected to load CSV data from a source and return SpreadSheetData.t structure.

Callbacks

load/3

Specs:

The load callback can be called by and updater process or by any other process wishing to load data.

The parameters:

  • sheets - A list of worksheets to load, if empty all worksheets available are to be loaded.
  • previous_version - Value returned by a previous call to loader or nil. All loaders should implement some way to check that data loaded is equal to previous load. In worst case it is possible to use hash value of spreadsheet for equality comparison, but in many cases there is a last modified timestamp or some other way to do this without loading all data. For example, the Docs loader uses element value of the atom feed.
  • config - Loader specific configuration options, for example might contain directory where to laod data or URL.

Return values:

  • {version, spreadsheet} - Tuple with version information and SpreadSheetData.t structure. The version parameter can be nil, if the loader can’t or doesn’t implement optimizations.
  • :unchanged - No changes since last load time.
  • :error - Unspecified error, will restart the udpater process.

The sheets parameter is a list of Worksheet names to load, if nill