New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Shared Formula master must exist above and or left of clone #676
Comments
|
@robophil Did you manage to solve this? |
|
So this was happening to me as well and I eventually found a solution that works well: just copy the whole value. For example: // Master
const masterCell = worksheet.getCell("A3")
masterCell.value = {
formula: "A1+A2",
result: myResult
}
// anywhere later...
// "Shared"
worksheet.getCell("A4").value = masterCell.value;Now if you change the values or |
I didn't actually. My previous company opted for https://github.com/SheetJS/js-xlsx with pro support. |
|
@robophil @enzoferey @williamluke4 i'm still facing this issue any solutions for this?..i have an excel with lot of formulas but i'm not changing anything just added a new column using spliceColumns and inserted few values in that column..these column doesnt have any formulas, but I'm getting the error mentioned here.. |
|
I'm also facing this problem. I wish the error at least tells me which cell? Thanks! |
|
@taviroquai |
|
@joobisb thanks for the info. I left original cells with formula intact and only fill new values/formula on empty cells. It was the only way to get around this. |
|
I finally realized what causes the error and it is really simple to overcome. Apparently dragging and dropping formulas in the excel template create these "slave-master relationships" that the library can't handle. The error does not occur if the templates formulas are inserted manually. So instead of writing in Cell A11: "=sum(A1:A10)" and then dragging the formula to cell B11 it is important to manually type in B11 "=sum(B1:B10)". The formulas generated by dragging and dropping are completely the same, but treated differently internally. |
|
If in the final excel you only care about the values you can test if it is a shared formula and grab the result: row[22] = row[22]['sharedFormula'] ? row[22]['result'] : row[22]; Or you follow the link: if (row[22]['sharedFormula']) { |
I want to insert new rows dynamically into my sheet and have them inherit the formula used above.
It logs this error
This works for some columns. So my question is, how do I set a share formula? or better yet, how can I achieve this differently if there's an alternative
The text was updated successfully, but these errors were encountered: