JavaScript
const data = [
['Zone', 'Salesman', 'Product', 'Qty', 'Amount', '', ''],
['North', 'Peter', 'A', '130', '1867', '', ''],
['South', 'Peter', 'B', '175', '1676', '', ''],
['East', 'Peter', 'A', '140', '1239', '', ''],
['West', 'Peter', 'B', '138', '1186', '', ''],
['North', 'John', 'A', '120', '1852', '', ''],
['South', 'John', 'B', '114', '1859', '', ''],
['East', 'John', 'A', '193', '1279', '', ''],
['West', 'John', 'B', '165', '1916', '', ''],
['', '', '', '', '', '', ''],
['Zone', 'Salesman', 'Product', 'Qty', 'Amount', '', ''],
['East', 'Peter', 'A', '=SUMIFS(D2:D9,A2:A9,A12,B2:B9,B12,C2:C9,C12)', '=SUMIFS(E2:E9,A2:A9,A12,B2:B9,B12,C2:C9,C12)', '', ''],
['*o*', 'John', '?', '=SUMIFS(D2:D9,A2:A9,A13,B2:B9,B13,C2:C9,C13)', '=SUMIFS(E2:E9,A2:A9,A13,B2:B9,B13,C2:C9,C13)', '', ''],
];
const container = document.getElementById('example-data-grid');
const hot = new Handsontable(container, {
data: data,
formulas: {
engine: HyperFormula,
},
colHeaders: true,
rowHeaders: true,
fixedRowsBottom: 2,
stretchH: 'all',
height: 500,
licenseKey: 'non-commercial-and-evaluation'
});
const formulaPlugin = hot.getPlugin('formulas');
const dependents = formulaPlugin.engine.getCellDependents({
sheet: 0,
col: 4,
row: 1,
});
console.log(dependents);