elixir_google_spreadsheets v0.1.16 GSS.Spreadsheet
Model of Google Spreadsheet for external interaction.
Link to this section Summary
Types
State of currently active Google spreadsheet:
%{
spreadsheet_id => "16Wgt0fuoYDgEAtGtYKF4jdjAhZez0q77UhkKdeKI6B4",
list_name => nil
}
Functions
Append row in a spreadsheet after an index
Batch update to append multiple rows
Returns a specification to start this module under a supervisor
Clear row in a spreadsheet by index
Batched clear, which deletes more then one record. Pass either an array of ranges, or start and end row indexes
Granural read by a custom range from a spreadsheet
Write values in batch based on a ranges schema
Get spreadsheet internal id
Invoked when the server is started. start_link/3
or start/3
will
block until it returns
Get spreadsheet properties
Read row in a spreadsheet by index
Batched read, which returns more than one record. Pass either an array of ranges (or rows), or start and end row indexes
Get total amount of rows in a spreadsheet
Get spreadsheet sheets from properties
Override row in a spreadsheet by index
Batch update to write multiple rows
Link to this section Types
spreadsheet_data()
spreadsheet_data() :: [String.t()]
spreadsheet_data() :: [String.t()]
spreadsheet_response()
spreadsheet_response() ::
{:json, map()} | {:error, Exception.t()} | no_return()
spreadsheet_response() :: {:json, map()} | {:error, Exception.t()} | no_return()
state()
state() :: map()
state() :: map()
State of currently active Google spreadsheet:
%{
spreadsheet_id => "16Wgt0fuoYDgEAtGtYKF4jdjAhZez0q77UhkKdeKI6B4",
list_name => nil
}
Link to this section Functions
append_row(pid, row_index, column_list, options \\ [])
append_row(pid(), integer(), spreadsheet_data(), Keyword.t()) :: :ok
append_row(pid(), integer(), spreadsheet_data(), Keyword.t()) :: :ok
Append row in a spreadsheet after an index.
append_rows(pid, row_index, data, options \\ [])
append_rows(pid(), integer(), [spreadsheet_data()], Keyword.t()) ::
:ok | {:error, Exception.t()}
append_rows(pid(), integer(), [spreadsheet_data()], Keyword.t()) :: :ok | {:error, Exception.t()}
Batch update to append multiple rows.
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
clear_row(pid, row_index, options \\ [])
Clear row in a spreadsheet by index.
clear_rows(pid, ranges)
clear_rows(pid(), [String.t()]) :: :ok | {:error, Exception.t()}
clear_rows(pid(), [String.t()]) :: :ok | {:error, Exception.t()}
Batched clear, which deletes more then one record. Pass either an array of ranges, or start and end row indexes.
clear_rows(pid, ranges, options)
clear_rows(pid(), [String.t()], Keyword.t()) :: :ok | {:error, Exception.t()}
clear_rows(pid(), integer(), integer()) :: :ok | {:error, Exception.t()}
clear_rows(pid(), [String.t()], Keyword.t()) :: :ok | {:error, Exception.t()}
clear_rows(pid(), integer(), integer()) :: :ok | {:error, Exception.t()}
clear_rows(pid, row_index_start, row_index_end, options)
clear_rows(pid(), integer(), integer(), Keyword.t()) ::
:ok | {:error, Exception.t()}
clear_rows(pid(), integer(), integer(), Keyword.t()) :: :ok | {:error, Exception.t()}
col_number_to_letters(col_number)
fetch(pid, range)
fetch(pid(), String.t()) :: {:ok, spreadsheet_data()} | {:error, Exception.t()}
fetch(pid(), String.t()) :: {:ok, spreadsheet_data()} | {:error, Exception.t()}
Granural read by a custom range from a spreadsheet.
handle_call(msg, from, state)
Write values in batch based on a ranges schema.
id(pid)
Get spreadsheet internal id.
init(arg)
Invoked when the server is started. start_link/3
or start/3
will
block until it returns.
init_arg
is the argument term (second argument) passed to start_link/3
.
Returning {:ok, state}
will cause start_link/3
to return
{:ok, pid}
and the process to enter its loop.
Returning {:ok, state, timeout}
is similar to {:ok, state}
,
except that it also sets a timeout. See the "Timeouts" section
in the module documentation for more information.
Returning {:ok, state, :hibernate}
is similar to {:ok, state}
except the process is hibernated before entering the loop. See
c:handle_call/3
for more information on hibernation.
Returning {:ok, state, {:continue, continue}}
is similar to
{:ok, state}
except that immediately after entering the loop
the c:handle_continue/2
callback will be invoked with the value
continue
as first argument.
Returning :ignore
will cause start_link/3
to return :ignore
and
the process will exit normally without entering the loop or calling
c:terminate/2
. If used when part of a supervision tree the parent
supervisor will not fail to start nor immediately try to restart the
GenServer
. The remainder of the supervision tree will be started
and so the GenServer
should not be required by other processes.
It can be started later with Supervisor.restart_child/2
as the child
specification is saved in the parent supervisor. The main use cases for
this are:
- The
GenServer
is disabled by configuration but might be enabled later. - An error occurred and it will be handled by a different mechanism than the
Supervisor
. Likely this approach involves callingSupervisor.restart_child/2
after a delay to attempt a restart.
Returning {:stop, reason}
will cause start_link/3
to return
{:error, reason}
and the process to exit with reason reason
without
entering the loop or calling c:terminate/2
.
Callback implementation for GenServer.init/1
.
properties(pid)
Get spreadsheet properties.
range(row_from, row_to, column_from, column_to)
range(row_from, row_to, column_from, column_to, state)
read_row(pid, row_index, options \\ [])
read_row(pid(), integer(), Keyword.t()) ::
{:ok, spreadsheet_data()} | {:error, Exception.t()}
read_row(pid(), integer(), Keyword.t()) :: {:ok, spreadsheet_data()} | {:error, Exception.t()}
Read row in a spreadsheet by index.
read_rows(pid, ranges)
read_rows(pid(), [String.t()] | [integer()]) ::
{:ok, [spreadsheet_data() | nil]} | {:error, Exception.t()}
read_rows(pid(), [String.t()] | [integer()]) :: {:ok, [spreadsheet_data() | nil]} | {:error, Exception.t()}
Batched read, which returns more than one record. Pass either an array of ranges (or rows), or start and end row indexes.
By default it returns nils
for an empty rows,
use pad_empty: true
and column_to: integer
options to fill records
with an empty string values.
read_rows(pid, ranges, options)
read_rows(pid(), [String.t()] | [integer()], Keyword.t()) ::
{:ok, [spreadsheet_data()]} | {:error, Exception.t()}
read_rows(pid(), integer(), integer()) ::
{:ok, [spreadsheet_data()]} | {:error, atom()}
read_rows(pid(), [String.t()] | [integer()], Keyword.t()) :: {:ok, [spreadsheet_data()]} | {:error, Exception.t()}
read_rows(pid(), integer(), integer()) :: {:ok, [spreadsheet_data()]} | {:error, atom()}
read_rows(pid, row_index_start, row_index_end, options)
rows(pid)
rows(pid()) :: {:ok, integer()} | {:error, Exception.t()}
rows(pid()) :: {:ok, integer()} | {:error, Exception.t()}
Get total amount of rows in a spreadsheet.
sheets(pid, opts \\ [])
Get spreadsheet sheets from properties.
start_link(spreadsheet_id, opts)
write_row(pid, row_index, column_list, options \\ [])
write_row(pid(), integer(), spreadsheet_data(), Keyword.t()) :: :ok
write_row(pid(), integer(), spreadsheet_data(), Keyword.t()) :: :ok
Override row in a spreadsheet by index.
write_rows(pid, ranges, data, opts \\ [])
write_rows(pid(), [String.t()], [spreadsheet_data()], Keyword.t()) ::
:ok | {:error, Exception.t()}
write_rows(pid(), [String.t()], [spreadsheet_data()], Keyword.t()) :: :ok | {:error, Exception.t()}
Batch update to write multiple rows.
Range schema should define the same amount of rows as amound of records in data and same amount of columns as entries in data record.