Iterate over cell Range #522
Replies: 9 comments
-
Hi @doczoidberg, would you mind sharing the solution? Was it |
Beta Was this translation helpful? Give feedback.
-
i did not found a solution yet |
Beta Was this translation helpful? Give feedback.
-
It's described in docs Example: const hfInstance = HyperFormula.buildFromArray([
['=SUM(1,2)', '2', '10'],
['5', '6', '7'],
['40', '30', '20'],
]);
// returns calculated cells content: [ [ 3, 2 ], [ 5, 6 ] ]
const rangeValues = hfInstance.getRangeValues({ sheet: 0, col: 0, row: 0 }, 2, 2); |
Beta Was this translation helpful? Give feedback.
-
but in your exmplae the parameter is not a cell range |
Beta Was this translation helpful? Give feedback.
-
i need to iterate over all CellAddresses of |
Beta Was this translation helpful? Give feedback.
-
I try
|
Beta Was this translation helpful? Give feedback.
-
solution:
|
Beta Was this translation helpful? Give feedback.
-
It is a Range starting in cell (0,0) and spreading across 2 rows and 2 columns. With
const precedents = hfInstance.getCellPrecedents();
const precedentsValues = precedents.map((simpleCellAddress) => hfInstance.getCellValue(simpleCellAddress)); |
Beta Was this translation helpful? Give feedback.
-
Found it. You're right. My solution has to be extended with support for the const precedents = hfInstance.getCellPrecedents();
const precedentsValues = precedents.map((precedent) => {
if (precedent.start) {
return hfInstance.getRangeValues(precedent.start, precedent.width, precedent.height);
}
return hfInstance.getCellValue(simpleCellAddress);
}); @izulin shouldn't we have an |
Beta Was this translation helpful? Give feedback.
-
how can I get all cell values of a cell Range?
i need to iterate over all CellAddresses of
hfInstance.getCellPrecedents
Beta Was this translation helpful? Give feedback.
All reactions