Place Formulas (setFormula) on SpreadJS headers (colHeader)

Posted by: plump.mentor-0z on 12 September 2022, 1:20 am EST

  • Posted 12 September 2022, 1:20 am EST

    I currently have a solution using AngularJS/SpreadJS where we need to update the header section with a formula. When we change a cell value in the header using setValue everythign displays ok, however we need to display a formula using setFormula, in these cases the formula gets calculated and displayed in the rows belonging to the actual sheet where my data is at.

    //Does not work and displays in row 2 of the sheet:

    sheet.setFormula(2, i, formula, GC.Spread.Sheets.SheetArea.colHeader);

    //Displays value in actual header in teh correct location/header cell

    sheet.setValue(2, i, ‘my formula!’, GC.Spread.Sheets.SheetArea.colHeader);

    Any help will be appreciated. Thanks!

  • Posted 13 September 2022, 2:12 am EST

    Hi,

    We are sorry currently header does not support formulas. what you could do is freeze the first row of the sheet and apply a formula to that row and treat it as a header.

    If you need you could hide the columnHeader using the following code snippet.

    
    ss.getActiveSheet().options.colHeaderVisible = false;
    
    

    regards,

    Avinash

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels