You can convert a formula string to the specified cell range using the formulaToRanges() method as shown in the code snippet shared below.
| JavaScript |
Copy Code
|
|---|---|
var spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), { sheetCount: 1 }); sheet = spread.getSheet(0); // Creating cell range using formulaToRanges() method cellRanges = GC.Spread.Sheets.CalcEngine.formulaToRanges(sheet, 'B3:D5', 0, 0); // Getting row/column indexes and rowCount/colCount of range in formula console.log("Starting Row Index of cell range 'B3:D5' is " + cellRanges[0].ranges[0].row); console.log("Starting Column Index of cell range 'B3:D5' is " + cellRanges[0].ranges[0].col); console.log("RowCount of cell range 'B3:D5' is " + cellRanges[0].ranges[0].rowCount); console.log("ColCount of cell range 'B3:D5' is " + cellRanges[0].ranges[0].colCount); |
|