View Source Sheetex (Sheetex v0.1.1)

For when you just want to fetch some rows from a Google Sheet.

See fetch_rows/2 for more information.

Summary

Types

@type cell() ::
  String.t()
  | integer()
  | float()
  | boolean()
  | nil
  | GoogleApi.Sheets.V4.Model.ErrorValue.t()
@type option() ::
  {:range, String.t()} | {:key, String.t()} | {:oauth_token, String.t()}
@type rows() :: [cell()] | nil

Functions

Link to this function

fetch_rows(spreadsheet_id, opts)

View Source
@spec fetch_rows(String.t(), [option()]) :: {:ok, rows()} | {:error, integer()}

Fetch rows from a Google Sheet.

For this to work, you need an API key or an OAuth token that will be passed to the Google Sheets API. See Google’s official authorization docs.

Options

You must provide either key OR oauth_token for authorization.

  • key – API key.
  • oauth_token – OAuth token.
  • range – Use this option if you want to fetch a specific range from a spreadsheet using the A1 notation.

Output

  • The output will include rows up to the last non-empty row in the sheet (or from within the specified range).
  • For each non-empty row, the output will contain a list of cell values up to the rightmost non-empty cell.
  • Empty rows are represented as nil.
Link to this function

fetch_rows!(spreadsheet_id, opts)

View Source
@spec fetch_rows!(String.t(), [option()]) :: rows()

See fetch_rows/2.