Handsontable example

HTML

<script src="https://cdn.jsdelivr.net/npm/handsontable@13.1/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@13.1/dist/handsontable.full.min.css" /> 
<script src="https://handsontable.com/docs/scripts/fixer.js"></script>

<div id="example-named-expressions1"></div>

Babel + JSX

import Handsontable from 'handsontable';
import HyperFormula from 'hyperformula';
import 'handsontable/dist/handsontable.full.min.css';

const data = [
  ['yes', 88, '=if(B1 < 100, "green, red", "")'],
  ['no', 188, '=if(B2 < 100, "green, red", "")']
];

function myRenderer(instance, td, row, col, prop, value, cellProperties) {
  Handsontable.renderers.TextRenderer.apply(this, arguments);
	
  const colors = value.split(',').map(color => color.trim());
  const [color1, color2] = colors;
   
    console.log(colors)
  	td.style.color = color1
    td.style.background = color2
  
}

const container = document.querySelector('#example-named-expressions1');
const hotNamedExpressions = new Handsontable(container, {
  data: data,
  colHeaders: true,
  colWidths: 100,
  rowHeaders: true,
  height: 'auto',
  formulas: {
    engine: HyperFormula
  },
  licenseKey: 'non-commercial-and-evaluation',
  cells: (row, col) => {
  	let cp = {}
    
    if(col == 2){
    	cp.renderer = myRenderer
    }
    
    return cp
  }
});