@leankylin-sheet/core
Version:
LeankylinSheet is a drop-in javascript spreadsheet library that provides rich features like Excel and Google Sheets
1,727 lines (1,724 loc) • 2.45 MB
JavaScript
import _, { isPlainObject, pick } from 'lodash';
import numeral from 'numeral';
import dayjs from 'dayjs';
import { Parser, ERROR_REF } from '@leankylin-sheet/formula-parser';
import { v4 } from 'uuid';
function _iterableToArrayLimit(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e,
n,
i,
u,
a = [],
f = !0,
o = !1;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = !1;
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
} catch (r) {
o = !0, n = r;
} finally {
try {
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a;
}
}
function ownKeys(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function (r) {
return Object.getOwnPropertyDescriptor(e, r).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread2(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
_defineProperty(e, r, t[r]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
});
}
return e;
}
function _regeneratorRuntime() {
_regeneratorRuntime = function () {
return e;
};
var t,
e = {},
r = Object.prototype,
n = r.hasOwnProperty,
o = Object.defineProperty || function (t, e, r) {
t[e] = r.value;
},
i = "function" == typeof Symbol ? Symbol : {},
a = i.iterator || "@@iterator",
c = i.asyncIterator || "@@asyncIterator",
u = i.toStringTag || "@@toStringTag";
function define(t, e, r) {
return Object.defineProperty(t, e, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}), t[e];
}
try {
define({}, "");
} catch (t) {
define = function (t, e, r) {
return t[e] = r;
};
}
function wrap(t, e, r, n) {
var i = e && e.prototype instanceof Generator ? e : Generator,
a = Object.create(i.prototype),
c = new Context(n || []);
return o(a, "_invoke", {
value: makeInvokeMethod(t, r, c)
}), a;
}
function tryCatch(t, e, r) {
try {
return {
type: "normal",
arg: t.call(e, r)
};
} catch (t) {
return {
type: "throw",
arg: t
};
}
}
e.wrap = wrap;
var h = "suspendedStart",
l = "suspendedYield",
f = "executing",
s = "completed",
y = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var p = {};
define(p, a, function () {
return this;
});
var d = Object.getPrototypeOf,
v = d && d(d(values([])));
v && v !== r && n.call(v, a) && (p = v);
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
function defineIteratorMethods(t) {
["next", "throw", "return"].forEach(function (e) {
define(t, e, function (t) {
return this._invoke(e, t);
});
});
}
function AsyncIterator(t, e) {
function invoke(r, o, i, a) {
var c = tryCatch(t[r], t, o);
if ("throw" !== c.type) {
var u = c.arg,
h = u.value;
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
invoke("next", t, i, a);
}, function (t) {
invoke("throw", t, i, a);
}) : e.resolve(h).then(function (t) {
u.value = t, i(u);
}, function (t) {
return invoke("throw", t, i, a);
});
}
a(c.arg);
}
var r;
o(this, "_invoke", {
value: function (t, n) {
function callInvokeWithMethodAndArg() {
return new e(function (e, r) {
invoke(t, n, e, r);
});
}
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
}
});
}
function makeInvokeMethod(e, r, n) {
var o = h;
return function (i, a) {
if (o === f) throw Error("Generator is already running");
if (o === s) {
if ("throw" === i) throw a;
return {
value: t,
done: !0
};
}
for (n.method = i, n.arg = a;;) {
var c = n.delegate;
if (c) {
var u = maybeInvokeDelegate(c, n);
if (u) {
if (u === y) continue;
return u;
}
}
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
if (o === h) throw o = s, n.arg;
n.dispatchException(n.arg);
} else "return" === n.method && n.abrupt("return", n.arg);
o = f;
var p = tryCatch(e, r, n);
if ("normal" === p.type) {
if (o = n.done ? s : l, p.arg === y) continue;
return {
value: p.arg,
done: n.done
};
}
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
}
};
}
function maybeInvokeDelegate(e, r) {
var n = r.method,
o = e.iterator[n];
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
var i = tryCatch(o, e.iterator, r.arg);
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
var a = i.arg;
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
}
function pushTryEntry(t) {
var e = {
tryLoc: t[0]
};
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
}
function resetTryEntry(t) {
var e = t.completion || {};
e.type = "normal", delete e.arg, t.completion = e;
}
function Context(t) {
this.tryEntries = [{
tryLoc: "root"
}], t.forEach(pushTryEntry, this), this.reset(!0);
}
function values(e) {
if (e || "" === e) {
var r = e[a];
if (r) return r.call(e);
if ("function" == typeof e.next) return e;
if (!isNaN(e.length)) {
var o = -1,
i = function next() {
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
return next.value = t, next.done = !0, next;
};
return i.next = i;
}
}
throw new TypeError(typeof e + " is not iterable");
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
value: GeneratorFunctionPrototype,
configurable: !0
}), o(GeneratorFunctionPrototype, "constructor", {
value: GeneratorFunction,
configurable: !0
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
var e = "function" == typeof t && t.constructor;
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
}, e.mark = function (t) {
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
}, e.awrap = function (t) {
return {
__await: t
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
return this;
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
void 0 === i && (i = Promise);
var a = new AsyncIterator(wrap(t, r, n, o), i);
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
return t.done ? t.value : a.next();
});
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
return this;
}), define(g, "toString", function () {
return "[object Generator]";
}), e.keys = function (t) {
var e = Object(t),
r = [];
for (var n in e) r.push(n);
return r.reverse(), function next() {
for (; r.length;) {
var t = r.pop();
if (t in e) return next.value = t, next.done = !1, next;
}
return next.done = !0, next;
};
}, e.values = values, Context.prototype = {
constructor: Context,
reset: function (e) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
},
stop: function () {
this.done = !0;
var t = this.tryEntries[0].completion;
if ("throw" === t.type) throw t.arg;
return this.rval;
},
dispatchException: function (e) {
if (this.done) throw e;
var r = this;
function handle(n, o) {
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
}
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
var i = this.tryEntries[o],
a = i.completion;
if ("root" === i.tryLoc) return handle("end");
if (i.tryLoc <= this.prev) {
var c = n.call(i, "catchLoc"),
u = n.call(i, "finallyLoc");
if (c && u) {
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
} else if (c) {
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
} else {
if (!u) throw Error("try statement without catch or finally");
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
}
}
}
},
abrupt: function (t, e) {
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
var o = this.tryEntries[r];
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
var i = o;
break;
}
}
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
var a = i ? i.completion : {};
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
},
complete: function (t, e) {
if ("throw" === t.type) throw t.arg;
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
},
finish: function (t) {
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
var r = this.tryEntries[e];
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
}
},
catch: function (t) {
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
var r = this.tryEntries[e];
if (r.tryLoc === t) {
var n = r.completion;
if ("throw" === n.type) {
var o = n.arg;
resetTryEntry(r);
}
return o;
}
}
throw Error("illegal catch attempt");
},
delegateYield: function (e, r, n) {
return this.delegate = {
iterator: values(e),
resultName: r,
nextLoc: n
}, "next" === this.method && (this.arg = t), y;
}
}, e;
}
function _toPrimitive(t, r) {
if ("object" != typeof t || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != typeof i) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == typeof i ? i : i + "";
}
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var en = {
generalDialog: {
partiallyError: "Cannot perform this operation on partially merged cells",
readOnlyError: "Cannot perform this operation in read-only mode",
dataNullError: "Cannot perform this operation on data that does not exist",
noSeletionError: "The selection operation has not been performed yet",
cannotSelectMultiple: "Cannot select multiple selections"
},
functionlist: [{
n: "SUMIF",
t: 0,
d: "Returns a conditional sum across a range.",
a: "A conditional sum across a range.",
m: [2, 3],
p: [{
name: "range",
detail: "The range which is tested against `criterion`.",
example: "A1:A10",
require: "m",
repeat: "n",
type: "range"
}, {
name: "criterion",
detail: "The pattern or test to apply to `range`.",
example: '">20"',
require: "m",
repeat: "n",
type: "rangeall"
}, {
name: "sum_range",
detail: "The range to be summed, if different from `range`.",
example: "B1:B10",
require: "o",
repeat: "n",
type: "range"
}]
}, {
n: "TAN",
t: 0,
d: "Returns the tangent of an angle provided in radians.",
a: "Tangent of an angle provided in radians.",
m: [1, 1],
p: [{
name: "angle",
detail: "The angle to find the tangent of, in radians.",
example: "45*PI()/180",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "TANH",
t: 0,
d: "Returns the hyperbolic tangent of any real number.",
a: "Hyperbolic tangent of any real number.",
m: [1, 1],
p: [{
name: "value",
detail: "Any real value to calculate the hyperbolic tangent of.",
example: "A2",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "CEILING",
t: 0,
d: "Rounds a number up to the nearest integer multiple of specified significance `factor`.",
a: "Rounds number up to nearest multiple of a factor.",
m: [2, 2],
p: [{
name: "value",
detail: "The value to round up to the nearest integer multiple of `factor`.",
example: "23.25",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "factor",
detail: "The number to whose multiples `value` will be rounded.",
example: "0.1",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "ATAN",
t: 0,
d: "Returns the inverse tangent of a value, in radians.",
a: "Inverse tangent of a value, in radians.",
m: [1, 1],
p: [{
name: "value",
detail: "The value for which to calculate the inverse tangent.",
example: "0",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "ASINH",
t: 0,
d: "Returns the inverse hyperbolic sine of a number.",
a: "Inverse hyperbolic sine of a number.",
m: [1, 1],
p: [{
name: "value",
detail: "The value for which to calculate the inverse hyperbolic sine.",
example: "0.9",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "ABS",
t: 0,
d: "Returns the absolute value of a number.",
a: "Absolute value of a number.",
m: [1, 1],
p: [{
name: "value",
detail: "The number of which to return the absolute value.",
example: "-2",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "ACOS",
t: 0,
d: "Returns the inverse cosine of a value, in radians.",
a: "Inverse cosine of a value, in radians.",
m: [1, 1],
p: [{
name: "value",
detail: "The value for which to calculate the inverse cosine. Must be between `-1` and `1`, inclusive.",
example: "0",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "ACOSH",
t: 0,
d: "Returns the inverse hyperbolic cosine of a number.",
a: "Inverse hyperbolic cosine of a number.",
m: [1, 1],
p: [{
name: "value",
detail: "The value for which to calculate the inverse hyperbolic cosine. Must be greater than or equal to `1`.",
example: "2",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "MULTINOMIAL",
t: 0,
d: "Returns the factorial of the sum of values divided by the product of the values' factorials.",
a: "Multinomial distribution function.",
m: [1, 255],
p: [{
name: "value1",
detail: "The first value or range to consider.",
example: "1",
require: "m",
repeat: "n",
type: "rangeall"
}, {
name: "value2",
detail: "Additional values or ranges to consider.",
example: "2",
require: "o",
repeat: "y",
type: "rangeall"
}]
}, {
n: "ATANH",
t: 0,
d: "Returns the inverse hyperbolic tangent of a number.",
a: "Inverse hyperbolic tangent of a number.",
m: [1, 1],
p: [{
name: "value",
detail: "The value for which to calculate the inverse hyperbolic tangent. Must be between -1 and 1, exclusive.",
example: "0.9",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "ATAN2",
t: 0,
d: "Returns the angle between the x-axis and a line segment from the origin (0,0) to specified coordinate pair (`x`,`y`), in radians.",
a: "Arctangent of a value.",
m: [2, 2],
p: [{
name: "x",
detail: "The x coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis.",
example: "4",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "y",
detail: "The y coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis.",
example: "3",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "COUNTBLANK",
t: 1,
d: "Returns the number of empty values in a list of values and ranges.",
a: "Number of empty values.",
m: [1, 1],
p: [{
name: "value1",
detail: "The first value or range in which to count the number of blanks.",
example: "A2:C100",
require: "m",
repeat: "n",
type: "range"
}]
}, {
n: "COSH",
t: 0,
d: "Returns the hyperbolic cosine of any real number.",
a: "Hyperbolic cosine of any real number.",
m: [1, 1],
p: [{
name: "value",
detail: "Any real value to calculate the hyperbolic cosine of.",
example: "A2",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "INT",
t: 0,
d: "Rounds a number down to the nearest integer that is less than or equal to it.",
a: "Rounds number down to nearest integer.",
m: [1, 1],
p: [{
name: "value",
detail: "The value to round down to the nearest integer.",
example: "99.44",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "ISEVEN",
t: 0,
d: "Checks whether the provided value is even.",
a: "Whether the provided value is even.",
m: [1, 1],
p: [{
name: "value",
detail: "The value to be verified as even.",
example: "4",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "ISODD",
t: 0,
d: "Checks whether the provided value is odd.",
a: "Whether the provided value is odd.",
m: [1, 1],
p: [{
name: "value",
detail: "The value to be verified as odd.",
example: "4",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "LCM",
t: 0,
d: "Returns the least common multiple of one or more integers.",
a: "Least common multiple of one or more integers.",
m: [1, 255],
p: [{
name: "value1",
detail: "The first value or range whose factors to consider in a calculation to find the least common multiple.",
example: "A2:A5",
require: "m",
repeat: "n",
type: "rangeall"
}, {
name: "value2",
detail: "Additional values or ranges whose factors to consider to find the least common multiple.",
example: "3",
require: "o",
repeat: "y",
type: "rangeall"
}]
}, {
n: "LN",
t: 0,
d: "Returns the logarithm of a number, base e (Euler's number).",
a: "The logarithm of a number, base e (euler's number).",
m: [1, 1],
p: [{
name: "value",
detail: "The value for which to calculate the logarithm, base e.",
example: "100",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "LOG",
t: 0,
d: "Returns the logarithm of a number with respect to a base.",
a: "The logarithm of a number with respect to a base.",
m: [1, 2],
p: [{
name: "value",
detail: "The value for which to calculate the logarithm.",
example: "128",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "base",
detail: "The base to use for calculation of the logarithm.",
example: "2",
require: "o",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "LOG10",
t: 0,
d: "Returns the logarithm of a number, base 10.",
a: "The logarithm of a number, base 10.",
m: [1, 1],
p: [{
name: "value",
detail: "The value for which to calculate the logarithm, base 10.",
example: "100",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "MOD",
t: 0,
d: "Returns the result of the modulo operator, the remainder after a division operation.",
a: "Modulo (remainder) operator.",
m: [2, 2],
p: [{
name: "dividend",
detail: "The number to be divided to find the remainder.",
example: "10",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "divisor",
detail: "The number to divide by.",
example: "4",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "MROUND",
t: 0,
d: "Rounds one number to the nearest integer multiple of another.",
a: "Rounds a number to the nearest integer multiple.",
m: [2, 2],
p: [{
name: "value",
detail: "The number to round to the nearest integer multiple of another.",
example: "21",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "factor",
detail: "The number to whose multiples `value` will be rounded.",
example: "14",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "ODD",
t: 0,
d: "Rounds a number up to the nearest odd integer.",
a: "Rounds a number up to the nearest odd integer.",
m: [1, 1],
p: [{
name: "value",
detail: "The value to round to the next greatest odd number.",
example: "2",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "SUMSQ",
t: 0,
d: "Returns the sum of the squares of a series of numbers and/or cells.",
a: "Sum of squares.",
m: [1, 255],
p: [{
name: "value1",
detail: "The first number or range whose squares to add together.",
example: "A2:A100",
require: "m",
repeat: "n",
type: "rangeall"
}, {
name: "value2",
detail: "Additional numbers or ranges whose squares to add to the square(s) of `value1`.",
example: "2",
require: "o",
repeat: "y",
type: "rangeall"
}]
}, {
n: "COMBIN",
t: 0,
d: "Returns the number of ways to choose some number of objects from a pool of a given size of objects.",
a: "Number of combinations from a set of objects.",
m: [2, 2],
p: [{
name: "n",
detail: "The size of the pool of objects to choose from.",
example: "4",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "k",
detail: "The number of objects to choose.",
example: "2",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "SUM",
t: 0,
d: "Returns the sum of a series of numbers and/or cells.",
a: "Sum of a series of numbers and/or cells.",
m: [1, 255],
p: [{
name: "value1",
detail: "The first number or range to add together.",
example: "A2:A100",
require: "m",
repeat: "n",
type: "rangeall"
}, {
name: "value2",
detail: "Additional numbers or ranges to add to `value1`.",
example: "2",
require: "o",
repeat: "y",
type: "rangeall"
}]
}, {
n: "SUBTOTAL",
t: 0,
d: "Returns a subtotal for a vertical range of cells using a specified aggregation function.",
a: "Subtotal for a range using a specific function.",
m: [2, 256],
p: [{
name: "function_code",
detail: "The function to use in subtotal aggregation.",
example: "1",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "range1",
detail: "The first range over which to calculate a subtotal.",
example: "A2:A5",
require: "m",
repeat: "n",
type: "range"
}, {
name: "range2",
detail: "Additional ranges over which to calculate subtotals.",
example: "B2:B8",
require: "o",
repeat: "y",
type: "range"
}]
}, {
n: "ASIN",
t: 0,
d: "Returns the inverse sine of a value, in radians.",
a: "Inverse sine of a value, in radians.",
m: [1, 1],
p: [{
name: "value",
detail: "The value for which to calculate the inverse sine. Must be between `-1` and `1`, inclusive.",
example: "0",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "COUNTIF",
t: 1,
d: "Returns a conditional count across a range.",
a: "A conditional count across a range.",
m: [2, 2],
p: [{
name: "range",
detail: "The range that is tested against `criterion`.",
example: "A1:A10",
require: "m",
repeat: "n",
type: "range"
}, {
name: "criterion",
detail: "The pattern or test to apply to `range`.",
example: '">20"',
require: "m",
repeat: "n",
type: "rangeall"
}]
}, {
n: "RADIANS",
t: 0,
d: "Converts an angle value in degrees to radians.",
a: "Converts an angle value in degrees to radians.",
m: [1, 1],
p: [{
name: "angle",
detail: "The angle to convert from degrees to radians.",
example: "180",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "RAND",
t: 0,
d: "Returns a random number between 0 inclusive and 1 exclusive.",
a: "A random number between 0 inclusive and 1 exclusive.",
m: [0, 0],
p: []
}, {
n: "COUNTUNIQUE",
t: 0,
d: "Counts the number of unique values in a list of specified values and ranges.",
a: "Counts number of unique values in a range.",
m: [1, 255],
p: [{
name: "value1",
detail: "The first value or range to consider for uniqueness.",
example: "A1:C100",
require: "m",
repeat: "n",
type: "rangeall"
}, {
name: "value2",
detail: "Additional values or ranges to consider for uniqueness.",
example: "1",
require: "o",
repeat: "n",
type: "rangeall"
}]
}, {
n: "DEGREES",
t: 0,
d: "Converts an angle value in radians to degrees.",
a: "Converts an angle value in radians to degrees.",
m: [1, 1],
p: [{
name: "angle",
detail: "The angle to convert from radians to degrees.",
example: "PI()",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "ERFC",
t: 9,
d: "Returns the complementary Gauss error function of a value.",
a: "Complementary gauss error function of a value.",
m: [1, 1],
p: [{
name: "z",
detail: "The number for which to calculate the complementary Gauss error function.",
example: "2",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "EVEN",
t: 0,
d: "Rounds a number up to the nearest even integer.",
a: "Rounds a number up to the nearest even integer.",
m: [1, 1],
p: [{
name: "value",
detail: "The value to round to the next greatest even number.",
example: "3",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "EXP",
t: 0,
d: "Returns Euler's number, e (~2.718) raised to a power.",
a: "Euler's number, e (~2.718) raised to a power.",
m: [1, 1],
p: [{
name: "exponent",
detail: "The exponent to raise e to.",
example: "2",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "FACT",
t: 0,
d: "Returns the factorial of a number.",
a: "Factorial of a number.",
m: [1, 1],
p: [{
name: "value",
detail: "The number or reference to a number whose factorial will be calculated and returned.",
example: "3",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "FACTDOUBLE",
t: 0,
d: 'Returns the "double factorial" of a number.',
a: '"double factorial" of a number.',
m: [1, 1],
p: [{
name: "value",
detail: "The number or reference to a number whose double factorial will be calculated and returned.",
example: "6",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "PI",
t: 0,
d: "Returns the value of Pi to 14 decimal places.",
a: "The number pi.",
m: [0, 0],
p: []
}, {
n: "FLOOR",
t: 0,
d: "Rounds a number down to the nearest integer multiple of specified significance `factor`.",
a: "Rounds number down to nearest multiple of a factor.",
m: [2, 2],
p: [{
name: "value",
detail: "The value to round down to the nearest integer multiple of `factor`.",
example: "23.25",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "factor",
detail: "The number to whose multiples `value` will be rounded.",
example: "0.1",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "GCD",
t: 0,
d: "Returns the greatest common divisor of one or more integers.",
a: "Greatest common divisor of one or more integers.",
m: [1, 255],
p: [{
name: "value1",
detail: "The first value or range whose factors to consider in a calculation to find the greatest common divisor.",
example: "A2:A5",
require: "m",
repeat: "n",
type: "rangeall"
}, {
name: "value2",
detail: "Additional values or ranges whose factors to consider to find the greatest common divisor.",
example: "96",
require: "o",
repeat: "y",
type: "rangeall"
}]
}, {
n: "RANDBETWEEN",
t: 0,
d: "Returns a uniformly random integer between two values, inclusive.",
a: "Random integer between two values, inclusive.",
m: [2, 2],
p: [{
name: "low",
detail: "The low end of the random range.",
example: "1",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "high",
detail: "The high end of the random range.",
example: "10",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "ROUND",
t: 0,
d: "Rounds a number to a certain number of decimal places according to standard rules.",
a: "Rounds a number according to standard rules.",
m: [2, 2],
p: [{
name: "value",
detail: "The value to round to `places` number of places.",
example: "99.44",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "places",
detail: "The number of decimal places to which to round.",
example: "1",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "ROUNDDOWN",
t: 0,
d: "Rounds a number to a certain number of decimal places, always rounding down to the next valid increment.",
a: "Rounds down a number.",
m: [2, 2],
p: [{
name: "value",
detail: "The value to round to `places` number of places, always rounding down.",
example: "99.44",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "places",
detail: "The number of decimal places to which to round.",
example: "1",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "ROUNDUP",
t: 0,
d: "Rounds a number to a certain number of decimal places, always rounding up to the next valid increment.",
a: "Rounds up a number.",
m: [2, 2],
p: [{
name: "value",
detail: "The value to round to `places` number of places, always rounding up.",
example: "99.44",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "places",
detail: "The number of decimal places to which to round.",
example: "1",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "SERIESSUM",
t: 0,
d: "Given parameters `x`, `n`, `m`, and `a`, returns the power series sum a",
a: "Sum of a power series.",
m: [4, 4],
p: [{
name: "x",
detail: "The input to the power series. Varies depending on the type of approximation, may be angle, exponent, or some other value.",
example: "1",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "n",
detail: "The initial power to which to raise `x` in the power series.",
example: "0",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "m",
detail: "The additive increment by which to increase `x`.",
example: "1",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "a",
detail: "The array or range containing the coefficients of the power series.",
example: "{FACT(0)",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "SIGN",
t: 0,
d: "Given an input number, returns `-1` if it is negative, `1` if positive, and `0` if it is zero.",
a: "Sign of a provided number (+/-/0).",
m: [1, 1],
p: [{
name: "value",
detail: "The value whose sign will be evaluated.",
example: "-42",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "SIN",
t: 0,
d: "Returns the sine of an angle provided in radians.",
a: "Sine of an angle provided in radians.",
m: [1, 1],
p: [{
name: "angle",
detail: "The angle to find the sine of, in radians.",
example: "PI()",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "SINH",
t: 0,
d: "Returns the hyperbolic sine of any real number.",
a: "Hyperbolic sine of any real number.",
m: [1, 1],
p: [{
name: "value",
detail: "Any real value to calculate the hyperbolic sine of.",
example: "A2",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "SQRT",
t: 0,
d: "Returns the positive square root of a positive number.",
a: "Positive square root of a positive number.",
m: [1, 1],
p: [{
name: "value",
detail: "The number for which to calculate the positive square root.",
example: "9",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "SQRTPI",
t: 0,
d: "Returns the positive square root of the product of Pi and the given positive number.",
a: "Square root of the product of pi and number.",
m: [1, 1],
p: [{
name: "value",
detail: "The number which will be multiplied by Pi and have the product's square root returned",
example: "9",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "GAMMALN",
t: 1,
d: "Returns the logarithm of a specified Gamma function, base e (Euler's number).",
a: "Logarithm of gamma function.",
m: [1, 1],
p: [{
name: "value",
detail: "The input to the Gamma function. The natural logarithm of Gamma(`value`) will be returned.",
example: "4",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "COS",
t: 0,
d: "Returns the cosine of an angle provided in radians.",
a: "Cosine of an angle provided in radians.",
m: [1, 1],
p: [{
name: "angle",
detail: "The angle to find the cosine of, in radians.",
example: "PI()",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "TRUNC",
t: 0,
d: "Truncates a number to a certain number of significant digits by omitting less significant digits.",
a: "Truncates a number.",
m: [1, 2],
p: [{
name: "value",
detail: "The value to be truncated.",
example: "3.141592654",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "places",
detail: "The number of significant digits to the right of the decimal point to retain.",
example: "2",
require: "o",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "QUOTIENT",
t: 0,
d: "Returns one number divided by another.",
a: "One number divided by another.",
m: [2, 2],
p: [{
name: "dividend",
detail: "The number to be divided.",
example: "4",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "divisor",
detail: "The number to divide by.",
example: "2",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "POWER",
t: 0,
d: "Returns a number raised to a power.",
a: "A number raised to a power.",
m: [2, 2],
p: [{
name: "base",
detail: "The number to raise to the `exponent` power.",
example: "4",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "exponent",
detail: "The exponent to raise `base` to.",
example: "0.5",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "SUMIFS",
t: 0,
d: "Returns the sum of a range depending on multiple criteria.",
a: "Sums a range depending on multiple criteria.",
m: [3, 257],
p: [{
name: "sum_range",
detail: "The range to sum.",
example: "A1:A10",
require: "m",
repeat: "n",
type: "range"
}, {
name: "criteria_range1",
detail: "The range to check against criterion1.",
example: " B1:B10",
require: "m",
repeat: "n",
type: "range"
}, {
name: "criterion1",
detail: "The pattern or test to apply to criteria_range1.",
example: ' ">20"',
require: "m",
repeat: "n",
type: "rangeall"
}, {
name: "criteria_range2",
detail: "Additional ranges to check.",
example: " C1:C10",
require: "o",
repeat: "y",
type: "rangeall"
}]
}, {
n: "COUNTIFS",
t: 1,
d: "Returns the count of a range depending on multiple criteria.",
a: "Count values depending on multiple criteria.",
m: [2, 256],
p: [{
name: "criteria_range1",
detail: "The range to check against `criterion1`.",
example: "A1:A10",
require: "m",
repeat: "n",
type: "range"
}, {
name: "criterion1",
detail: "The pattern or test to apply to `criteria_range1`.",
example: ' ">20"',
require: "m",
repeat: "n",
type: "rangeall"
}, {
name: "criteria_range2",
detail: "Additional ranges to check.",
example: " B1:B10",
require: "o",
repeat: "y",
type: "rangeall"
}]
}, {
n: "PRODUCT",
t: 0,
d: "Returns the result of multiplying a series of numbers together.",
a: "Result of multiplying a series of numbers together.",
m: [1, 255],
p: [{
name: "factor1",
detail: "The first number or range to calculate for the product.",
example: "A2:A100",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "factor2",
detail: "More numbers or ranges to calculate for the product.",
example: "2",
require: "o",
repeat: "y",
type: "rangenumber"
}]
}, {
n: "HARMEAN",
t: 1,
d: "Calculates the harmonic mean of a dataset.",
a: "The harmonic mean of a dataset.",
m: [1, 255],
p: [{
name: "value1",
detail: "The first value or range of the population.",
example: "1",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "value2",
detail: "Additional values or ranges to include in the population.",
example: "2",
require: "o",
repeat: "y",
type: "rangenumber"
}]
}, {
n: "HYPGEOMDIST",
t: 1,
d: "Calculates the probability of drawing a certain number of successes in a certain number of tries given a population of a certain size containing a certain number of successes, without replacement of draws.",
a: "Hypergeometric distribution probability.",
m: [5, 5],
p: [{
name: "num_successes",
detail: "The desired number of successes.",
example: "4",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "num_draws",
detail: "The number of permitted draws.",
example: "12",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "successes_in_pop",
detail: "The total number of successes in the population.",
example: "20",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "pop_size",
detail: "The total size of the population",
example: "40",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "cumulative",
detail: "Determine the logical value of the function form. \n\nIf cumulative is TRUE(), HYPGEOM.DIST returns the cumulative distribution function;\n\nif FALSE(), it returns the probability density function.",
example: "TRUE()",
require: "m",
repeat: "n",
type: "rangeall"
}]
}, {
n: "INTERCEPT",
t: 1,
d: "Calculates the y-value at which the line resulting from linear regression of a dataset will intersect the y-axis (x=0).",
a: "Y-intercept of line derived via linear regression.",
m: [2, 2],
p: [{
name: "data_y",
detail: "The range representing the array or matrix of dependent data.",
example: "A2:A100",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "data_x",
detail: "The range representing the array or matrix of independent data.",
example: "B2:B100",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "KURT",
t: 1,
d: 'Calculates the kurtosis of a dataset, which describes the shape, and in particular the "peakedness" of that dataset.',
a: "Kurtosis of a dataset.",
m: [1, 255],
p: [{
name: "value1",
detail: "The first value or range of the dataset.",
example: "1",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "value2",
detail: "Additional values or ranges to include in the dataset.",
example: "2",
require: "o",
repeat: "y",
type: "rangenumber"
}]
}, {
n: "LARGE",
t: 1,
d: "Returns the nth largest element from a data set, where n is user-defined.",
a: "Nth largest element from a data set.",
m: [2, 2],
p: [{
name: "data",
detail: "Array or range containing the dataset to consider.",
example: "A2:B100",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "n",
detail: "The rank from largest to smallest of the element to return.",
example: "4",
require: "m",
repeat: "n",
type: "rangenumber"
}]
}, {
n: "STDEVA",
t: 1,
d: "Calculates the standard deviation based on a sample, setting text to the value `0`.",
a: "Standard deviation of sample (text as 0).",
m: [1, 255],
p: [{
name: "value1",
detail: "The first value or range of the sample.",
example: "1",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "value2",
detail: "Additional values or ranges to include in the sample.",
example: "2",
require: "o",
repeat: "y",
type: "rangenumber"
}]
}, {
n: "STDEVP",
t: 1,
d: "Calculates the standard deviation based on an entire population.",
a: "Standard deviation of an entire population.",
m: [1, 255],
p: [{
name: "value1",
detail: "The first value or range of the population.",
example: "1",
require: "m",
repeat: "n",
type: "rangenumber"
}, {
name: "value2",
detail: "Additional values or ranges to include in the population.",
example: "2",
require: "o",
repeat: "y",
type: "rangenumber"
}]
}, {
n: "GEOMEAN",
t: 1,
d: "Calculates the geometric mean of a dataset.",
a: "The geometric mean of a dataset.",
m: [1, 255],
p: [{
name: "v