Open Pistorius opened 7 years ago
I have exactly the same problem
I am looking for a solution to this also. However, in Excel (on mac) pressing SHIFT+CTRL+ALT+FN+F9 forces rebuilding of dependency tree and does a full recalculation.
VBA solution, which I cannot try without Office subscription, is to put macros into the functions with a Application.Volatile call: https://docs.microsoft.com/en-us/office/vba/api/excel.application.volatile
@amaizels-placed There's a lot of work that needs to be done to fully support Excel formilas. If you are willing to help, I recommend looking at this branch as references are integral to dealing with formulas.
This snippet solved the problem for me.
book = RubyXL::Parser.parse(excel_path) book.calc_pr.full_calc_on_load = true
I also started saving the output to a separate file because "Excel does stuff I have no control over"
This seems to be a duplicate of #94 (which is from 2014 btw...)
Can we close this issue?
In case someone else comes here looking for an answer, one possible workaround that seemed to work for me is to clear the values of all cells that have formulas:
workbook.worksheets.each do |worksheet|
worksheet.sheet_data.rows.each do |row|
row&.cells&.each do |cell|
cell.value_container.value = nil if cell&.formula
end
end
end
... otherwise they would keep their previous values, even when using the book.calc_pr.full_calc_on_load = true
setting mentioned above.
(I was going to use cell.change_contents(nil, cell.formula)
but this doesn't work if the formula is "shared")
When i change some value in a cell referenced by other with a formula, the result of the value in the cell with the formula does not update. Is this a normal behaviour? Here is the example: