class

Sheety::FormulaExtractor

Inherits Reference < Object

Class methods

extract(filename : String, sheet_index : Int32) : Hash(String, String)

Extract formulas from a specific worksheet in an xlsx file Returns a hash mapping cell references to formula strings

Source
extract_cell_types(filename : String, sheet_index : Int32) : Hash(String, String)

Extract the XML cell type ("n"/absent = numeric, "s" = shared string, "b" = boolean, ...) per cell reference. Needed because xlsx-parser returns integer-valued numeric cells as strings, and only this attribute knows whether a "100" was a number or text.

Source
translate_shared(master : String, from_ref : String, to_ref : String) : String

Translate a shared formula from its master cell to a slave cell by offsetting relative references (Excel semantics). $-anchored row/column parts stay put; text inside string literals is untouched.

This is a pragmatic translation: function names followed by "(" (LOG10), sheet names (Sheet1, and the "A1!" edge), and named ranges don't match the cell-reference token pattern. References shifted off the sheet become #REF!, as in Excel.

Source