SpreadSheet allows performing operations with simple cell content (numbers, strings) and operators (arithmetic, comparison, etc.) as well as with built-in functions and custom functions. It is also possible to combine regular operands and functions in more complex formulas. The component processes them and displays the result in the related cells.
The syntax of a formula is the same as in Excel.
"data": [
[ 3, 2, "=A1+B2",""],
[ 4, 2, "=7+8",""],
[ 5, 2, "=7+B2",""],
[ 6, 2, "=SUM(A3+D7)",""]
...
]
4 . There are two variants of recording a formula, depending on which you can get different results:
"data": [
[ 7, 2, "=SUM(A3,D7)",""]
]
"data": [
[ 7, 2, "=SUM(A3:D7)",""]
]
You can contatenate string content of cells. There are three possible ways for this:
1 . use two text strings or references to the necessary cells and the & operator as: "=nice"&"trip" or =A1&B2
2 . use two text strings or references to the necessary cells and the + operator as: ="nice"+"trip" or =A1+B2. The "+" operator will sum numeric values and concatenate the values if summing is not possible (e.g. ="nice"+12).
3 . apply the CONCATENATE() function, like this: =CONCATENATE("nice","trip" or A1,B2). It's also possible to connect strings from a range of cells to produce one continuous text: =CONCATENATE(C2:D4)
You can specify a name for a particular range of cells and then use it in formulas for calculations.
Thus, the formula will be easier to understand and work with.
You can add a named range and manipulate it through the ranges collection:
to add a new named range, use the ranges.add() method and pass two parameters to it:
$$("ssheet").ranges.add("MYRANGE","B2:C2");
var code = $$("ssheet").ranges.getCode("MYRANGE"); // -> "B2:C2"
var data = $$("ssheet").ranges.getData("MYRANGE"); // -> ["100", "200", "300"]
var ranges = $$("ssheet").ranges.getRanges(); // -> [{name:"K",range:"C3:D3"},...]
$$("ssheet").ranges.remove("MYRANGE");
You have a possibility to link data of several sheets and use these cross references in formulas to process them together.
The rules of creating a reference to an external sheet are quite simple:
Here are some use cases that demonstrate how you can use cross references in multi sheets:
Related sample: Spreadsheet: Multiple Sheets
Spreadsheet possesses an advanced formula editor. Its main features are:
It's easy to enable the formula editor, just set the liveEditor property to true in the spreadsheet configuration:
webix.ui({
view: "spreadsheet",
data: base_data,
liveEditor: true
});
Back to top