Function reference
Every function the engine computes — 177 builtins, names case-insensitive, callable plain (=sum(B2:B7)) or piped (=B2:B7 | sum()). This inventory is verified against the engine's registry: everything listed here passes tsv check, and nothing is listed that doesn't.
Math & trig
Arithmetic beyond the operators — rounding, powers, logs, and the trig family.
abs(x) | Absolute value of x. |
|---|---|
acos(x) | Arccosine, in radians. |
asin(x) | Arcsine, in radians. |
atan(x) | Arctangent, in radians. |
atan2(x, y) | Arctangent of y/x, quadrant-aware. |
cos(x) | Cosine of x radians. |
cosh(x) | Hyperbolic cosine. |
degrees(rad) | Radians → degrees. |
exp(x) | e raised to x. |
int(x) | Rounds x down to the nearest integer. |
ln(x) | Natural logarithm. |
log(x, [base]) | Logarithm of x — base 10 unless base is given. |
log10(x) | Base-10 logarithm. |
mod(a, b) | Remainder of a ÷ b (there is no binary % — the postfix % is percent). |
pi() | The constant π. |
power(x, y) | x raised to y — the function form of ^. |
product(range, …) | Multiplies every number in its arguments. |
quotient(a, b) | Integer part of a ÷ b. |
radians(deg) | Degrees → radians. |
round(x, [n]) | x rounded to n decimal places (0 if omitted). |
sign(x) | -1, 0, or 1 by the sign of x. |
sin(x) | Sine of x radians. |
sinh(x) | Hyperbolic sine. |
sqrt(x) | Square root. |
sqrtpi(x) | Square root of x·π. |
sum(range, …) | Adds every number in its arguments. |
sumif(range, criteria, [sum_range]) | Adds the cells that meet a criteria — ">5", a value, or text. |
sumsq(range, …) | Sum of squares. |
tan(x) | Tangent of x radians. |
tanh(x) | Hyperbolic tangent. |
trunc(x) | Truncates toward zero. |
Statistical
Aggregates and order statistics over ranges.
average(range, …) | Arithmetic mean of the numbers. |
|---|---|
averageif(range, criteria, [avg_range]) | Mean of the cells meeting a criteria. |
avg(range, …) | Alias of average. |
count(range, …) | How many cells hold numbers. |
counta(range, …) | How many cells are non-empty. |
countblank(range) | How many cells are empty. |
countif(range, criteria) | How many cells meet a criteria. |
geomean(range, …) | Geometric mean. |
large(range, k) | The k-th largest value. |
max(range, …) | Largest number. |
median(range, …) | Middle value. |
min(range, …) | Smallest number. |
mode(range, …) | Most frequent value. |
small(range, k) | The k-th smallest value. |
stdev(range, …) | Sample standard deviation. |
stdevp(range, …) | Population standard deviation. |
var(range, …) | Sample variance. |
varp(range, …) | Population variance. |
Timeseries
Windowed series over a range — read positionally as a dense numeric series, each result spilling an equal-length column.
cumsum(range) | The running total. |
|---|---|
ema(range, n) | Exponential moving average — smoothing 2/(n+1), seeded with the first element. |
movingavg(range, n) | Trailing n-window mean; positions without a full window are #N/A. |
rollingmax(range, n) | Trailing n-window maximum. |
rollingmin(range, n) | Trailing n-window minimum. |
Logical
Branching and boolean algebra — TRUE/FALSE are also bare literals.
and(a, b, …) | TRUE when every argument is truthy. |
|---|---|
false() | The boolean FALSE (also writable as the literal FALSE). |
if(cond, then, else) | then when cond is truthy, else else — only the taken branch is evaluated. |
iferror(value, fallback) | value, unless it is any error — then fallback. |
ifna(value, fallback) | value, unless it is #N/A — then fallback. |
ifs(cond1, val1, cond2, val2, …) | First value whose condition is truthy; #N/A when none is. |
not(x) | Boolean negation. |
or(a, b, …) | TRUE when any argument is truthy. |
switch(expr, case1, val1, …, [default]) | The value paired with the first case equal to expr. |
true() | The boolean TRUE (also writable as the literal TRUE). |
xor(a, b, …) | TRUE when an odd number of arguments are truthy. |
Information
Predicates and probes over a value's kind.
isblank(x) | TRUE for an empty cell. |
|---|---|
iserr(x) | TRUE for any error except #N/A. |
iserror(x) | TRUE for any error value. |
iseven(x) | TRUE for an even integer part. |
islogical(x) | TRUE for a boolean. |
isna(x) | TRUE for #N/A. |
isnontext(x) | TRUE for anything but text. |
isnumber(x) | TRUE for a number. |
isodd(x) | TRUE for an odd integer part. |
istext(x) | TRUE for text. |
n(x) | x as a number — booleans become 1/0, text becomes 0. |
na() | The #N/A error value. |
t(x) | x when it is text, else empty. |
type(x) | A number code for x's kind. |
Text
Slicing, casing, searching, and regex over cell text.
char(n) | The character for ASCII code n. |
|---|---|
clean(text) | Strips non-printable characters. |
code(text) | ASCII code of the first character. |
concat(a, b, …) | Joins the text of every argument (& is the operator form). |
concatenate(a, b, …) | Alias of concat. |
exact(a, b) | TRUE when two texts match case-sensitively. |
find(needle, haystack, [start]) | Position of needle (case-sensitive), or #VALUE! when absent. |
left(text, [n]) | First n characters (1 if omitted). |
len(text) | Length in characters. |
lower(text) | Lower-cased. |
mid(text, start, n) | n characters from position start (1-based). |
proper(text) | Each Word Capitalized. |
regexextract(text, pattern) | First regex match, or #N/A. |
regexmatch(text, pattern) | TRUE when the regex matches. |
regexreplace(text, pattern, replacement) | Regex-replaces every match. |
replace(text, start, n, new) | Replaces n characters at start with new. |
rept(text, n) | text repeated n times — the one-line bar chart (see the examples in the docs). |
right(text, [n]) | Last n characters (1 if omitted). |
search(needle, haystack, [start]) | Like find, but case-insensitive. |
substitute(text, old, new, [nth]) | Replaces old with new — every occurrence, or only the nth. |
trim(text) | Collapses runs of spaces and trims the ends. |
unichar(n) | The character for Unicode code point n. |
unicode(text) | Code point of the first character. |
upper(text) | Upper-cased. |
value(text) | text parsed as a number, else #VALUE!. |
JSON
Pure parsing of a JSON text cell — dotted/indexed paths (a.b[0].c), no I/O; a path that does not resolve is
jsonget(x, path) | The value at a path — JSON scalars map into cell values; a container yields its compact JSON text. |
|---|---|
jsonkeys(x, [path]) | An object's keys in document order — spills a column. |
jsonlen(x, [path]) | An array's element count or an object's member count. |
jsonset(x, path, value) | The document with the path set — member order and number literals preserved, new keys appended. |
jsontype(x, [path]) | "null", "boolean", "number", "string", "array", or "object". |
URL
Absolute-URL component extraction and RFC 3986 percent-encoding.
urldecode(x) | Reverses %XX percent-encoding — a "+" stays a "+". |
|---|---|
urlencode(x) | Percent-encodes everything outside RFC 3986's unreserved set — a space is %20, never "+". |
urlfragment(x) | The decoded fragment. |
urlhost(x) | The host, without any port. |
urlpath(x) | The decoded path. |
urlquery(x, key) | The first value of a query parameter; a missing key is #N/A. |
urlscheme(x) | The scheme. |
Syntactic address checks — never DNS.
emaildomain(x) | The domain, after the last @. |
|---|---|
emailuser(x) | The local part, before the last @. |
emailvalid(x) | TRUE iff x is a bare, syntactically valid address. |
Crypto
Digests and verification over text or a range's canonical TSV serialization — a digest cell makes a sheet tamper-evident, a verify cell makes it self-verifying. Signing never happens in a formula.
base64(x) | Standard padded Base64 of the text form. |
|---|---|
crc32(x) | IEEE CRC-32 as 8 hex digits — a checksum, not cryptographic. |
digest(range, [algo]) | Digest of the range's canonical serialization — sha256 (default), sha512, or crc32. |
hex(x) | Lowercase hex of the text form's bytes. |
hmac(key, x, [algo]) | Keyed digest in lowercase hex — sha256 (default) or sha512. |
sha256(x) | SHA-256 in lowercase hex. |
sha512(x) | SHA-512 in lowercase hex. |
unbase64(x) | Reverses base64; malformed or non-UTF-8 input is #VALUE!. |
unhex(x) | Reverses hex; malformed or non-UTF-8 input is #VALUE!. |
verify(signature, pubkey, range) | TRUE/FALSE — does the hex Ed25519 signature verify over the range's canonical serialization. |
Date & time
Date serials with ISO rendering. The clock functions read the injected clock, but nothing refreshes on its own — wrap a cell in volatile() to re-read the clock on a schedule (see Volatility & generators).
date(y, m, d) | The date serial for a calendar day. |
|---|---|
datevalue(text) | Parses a date text to its serial. |
day(serial) | Day of month, 1–31. |
days(end, start) | Whole days between two dates. |
edate(serial, months) | Same day, months later (or earlier). |
eomonth(serial, months) | Last day of the month, months away. |
hour(serial) | Hour, 0–23. |
minute(serial) | Minute, 0–59. |
month(serial) | Month, 1–12. |
now() volatile | The current date-time; live only inside volatile(). |
second(serial) | Second, 0–59. |
today() volatile | Today's date; live only inside volatile(). |
weekday(serial, [type]) | Day of week as a number; type picks the numbering convention. |
year(serial) | The year. |
isnow(pattern) volatile | TRUE when the current instant matches an isnow pattern — a whole date/time pattern language in one cell; live only inside volatile(). The isnow page → |
Volatility & generators
volatile(expr, [schedule]) is the sole marker that a cell re-evaluates over time — a frontend recomputes it on the schedule (an isnow pattern, a duration, or the default tick). The generators are pure within a pass; wrap them in volatile() to re-roll or advance each refresh. Nothing is volatile without volatile().
volatile(expr, [schedule]) volatile | expr, re-evaluated each refresh; marks the cell volatile at schedule (an isnow pattern or duration), else a wrapped isnow pattern's own cadence, else the default tick. Also spelled expr | volatile. |
|---|---|
rand() volatile | A random number in [0, 1). Wrap in volatile() to re-roll each refresh. |
random() volatile | Alias of rand(). |
randbetween(lo, hi) volatile | A random integer in [lo, hi] inclusive. |
randarray(rows, [cols]) volatile | An array of random [0, 1) numbers that spills. |
tick() volatile | The recompute-pass ordinal (0, 1, 2, …) — a frame counter for animation. Wrap in volatile() to advance. |
frame() volatile | Alias of tick(). |
Lookup & reference
Finding values by position and position by value.
choose(n, v1, v2, …) | The n-th value argument. |
|---|---|
columns(range) | How many columns a range spans. |
hlookup(key, table, row, [exact]) | Finds key in the first row, returns the cell below it. |
index(range, row, [col]) | The cell at a position in a range. |
match(key, range, [mode]) | The position of key in a range. |
rows(range) | How many rows a range spans. |
transpose(range) | The range with rows and columns swapped. |
vlookup(key, table, col, [exact]) | Finds key in the first column, returns the cell beside it. |
Dynamic arrays
Functions whose result is a whole array.
filter(range, mask) | The cells of range where the mask is truthy. |
|---|---|
flatten(range, …) | Every cell of the arguments as one column. |
sequence(rows, [cols]) | Sequential numbers filling the shape. |
sort(range) | The range's values, sorted. |
unique(range) | The distinct values, first occurrence order. |
Financial
The time-value-of-money basics.
fv(rate, nper, pmt, [pv]) | Future value of regular payments. |
|---|---|
npv(rate, range) | Net present value of a cash-flow series. |
pmt(rate, nper, pv) | The periodic payment for a loan. |
pv(rate, nper, pmt) | Present value of regular payments. |
sln(cost, salvage, life) | Straight-line depreciation per period. |
Sheets as functions
A whole spreadsheet, embedded as one cell — the tsvsheet superpower (SPECIFICATION §8).
sheet(path, arg, …) | Computes the sheet at path and yields its output cell's value — a .tsvt used as a function. Paths are confined to the sheet's directory tree by default. |
|---|---|
input(n) | Inside an embedded sheet: the n-th argument the embedding sheet(…) call passed. |
output(expr) | Marks its cell as the sheet's single output; its value is expr. |
Import
Values-only import of external data over HTTPS — tsvsheet's own media types preferred, plain TSV and CSV accepted; off by default, behind an operator allowlist.
importcell(source, …) | One cell from an external source. |
|---|---|
importrow(source, …) | One row from an external source. |
importcolumn(source, …) | One column from an external source. |
importrange(source, …) | A rectangle from an external source. |
importsheet(source, …) | A whole external sheet. |
Semantics worth knowing
- Errors propagate.
#REF!#DIV/0!#VALUE!#NAME?#N/A#CIRC!flow through any expression that reads them; test them withiserror/isna, absorb them withiferror/ifna. - Volatile means live. Wrap a cell in
volatile()and it re-evaluates over time —today/now/isnowre-read the clock,rand/tickre-roll — so the playground and<tsv-sheet>re-render as time passes, and CI can recompute on a schedule. - Some results are columns. The dynamic arrays, the timeseries windows, and
jsonkeysspill down from their cell; a blocked spill is#SPILL!.digest/verifyread a range as its canonical TSV serialization — computed cells TAB-joined, LF-terminated rows — which is what makes a digest cell tamper-evident and a verify cell proof. - The pipe is sugar.
expr | fn(args)is exactlyfn(expr, args)— chains fold left, andexplainshows the ordinary call. - Unknown names are caught early.
tsv checkflags a call to anything not on this page, before you ever compute.
Want to see any of these run? Open the playground →