SpreadJS 15
Features / Formulas / Create Custom Names
In This Topic
    Create Custom Names
    In This Topic

    Custom, user-defined names are identifiers that represent information in the sheet. A custom name can refer to a range of cells or a formula. You can define a custom name and then use the name in formulas. When the formula is evaluated, the custom name's value is referenced and evaluated. Use the addCustomName method to create a custom name.

    Using Code

    This example creates a custom name.

    Copy Code
    activeSheet.setValue(0, 0, 1);
    activeSheet.setValue(0, 1, 2);
    activeSheet.setValue(0, 2, 3);
    activeSheet.addCustomName("customName1","=12", 0, 0);
    activeSheet.addCustomName("customName2","Average(20,45)", 0, 0);
    activeSheet.addCustomName("customName3", "=$B$1:$C$1", 0, 0);
    activeSheet.setFormula(1, 0, "customName1");
    activeSheet.setFormula(1, 1, "customName2");
    activeSheet.setFormula(1, 2, "sum(customName3)");