Skip to main content


sets style to a cell(s)

setStyle: (cell: string, styles: string | string[] | IStylesList | IStylesList[]) => void;


  • cell: string - the id(s) of a cell(s) or a range of cells
  • style: object | array - styles that should be applied to cells


// setting style for one cell
spreadsheet.setStyle("A1",{background:"red", border:"solid 1px yellow"});
// setting the same style for a range of cells
// setting the same style for different cells
// setting styles from an array for cells in a range alternately

1. The method allows setting the same style for the specified cells. In case you want to apply different cells to spreadsheet cells, you'd better use the parse() method.

Related sample: Spreadsheet. Styled Data

2. Starting with v4.1, the reference to a cell or range of cells can be specified in the following format:

spreadsheet.setStyle("sheet1!A2", {background:"red", border:"solid 1px yellow"}); 

where sheet1 is the name of the tab.

In case the name of the tab isn't specified, the method will apply the style to the cell(s) of the active tab.