elixlsx v0.0.1 Elixlsx.Util
Summary
Functions
returns the column index associated with a given letter
returns the column letter(s) associated with a column index. Col idx starts at 1
returns a tuple {row, col} corresponding to the input. row and col are 1-indexed, use from_excel_coords0 for zero-indexing
See from_excel_coords/1
Returns the ISO String representation (in UTC) for a erlang datetime() or datetime1970() object
returns
replace_all(input, [{search, replace}])
Returns the Char/Number representation of a given row/column combination. Indizes start with 1
Timestampts that are already in excel format are passed through unmodified
Types
datetime_t :: :calendar.datetime
Functions
Specs
decode_col([char] | String.t) :: non_neg_integer
returns the column index associated with a given letter.
Example
iex> decode_col("AB")
28
iex> decode_col("A")
1
Specs
encode_col(non_neg_integer) :: String.t
returns the column letter(s) associated with a column index. Col idx starts at 1.
Example
iex> encode_col(1)
"A"
iex> encode_col(28)
"AB"
Specs
from_excel_coords(String.t) :: {pos_integer, pos_integer}
returns a tuple {row, col} corresponding to the input. row and col are 1-indexed, use from_excel_coords0 for zero-indexing.
Example:
iex> from_excel_coords("C2")
{2, 3}
iex> from_excel_coords0("C2")
{1, 2}
Specs
from_excel_coords0(String.t) :: {non_neg_integer, non_neg_integer}
See from_excel_coords/1
Specs
iso_from_datetime(datetime_t) :: String.t
Returns the ISO String representation (in UTC) for a erlang datetime() or datetime1970() object.
Example
iex> iso_from_datetime {{2000, 12, 30}, {23, 59, 59}}
"2000-12-30T23:59:59Z"
returns
- the current current timestamp if input is nil,
- the UNIX-Timestamp interpretation when given an integer,
both in ISO-Repr.
If input is a String, the string is returned.
iex> iso_timestamp 0
"1970-01-01T00:00:00Z"
iex> iso_timestamp 1447885907
"2015-11-18T22:31:47Z"
It doesn't validate string inputs though:
iex> iso_timestamp "goat"
"goat"
replace_all(input, [{search, replace}])
Example
iex> replace_all("Hello World", [{"e", "E"}, {"o", "oO"}])
"HElloO WoOrld"
Specs
to_excel_coords(number, number) :: String.t
Returns the Char/Number representation of a given row/column combination. Indizes start with 1.
Examples
iex> to_excel_coords(1, 1)
"A1"
iex> to_excel_coords(10, 27)
"AA10"
Specs
to_excel_datetime(number) :: number
to_excel_datetime(datetime_t) :: number
Timestampts that are already in excel format are passed through unmodified.