Formula Tools
The Formula Tools module contains a number of functions used internally by the Formula class.
Functions
|
Function that checks whether a formula string starts with an equals sign. |
Function that gets a column letter for a column in a Table. |
|
|
Function that returns the starting row and column of a table. |
|
Function that constructs a value's cell reference from its reference attribute. |
|
Function that returns a formula after replacing some passed substring with another substring. |
|
Function that gets a Table column's range string. |
- chromaquant.utils.formula_tools.check_formula_starts_with_equals(formula: str) bool
Function that checks whether a formula string starts with an equals sign.
Parameters
- formulastr
Excel formula string.
Returns
- tf: bool
True if formula starts with equals sign, False if not.
- chromaquant.utils.formula_tools.get_column_letter_from_table(table_reference: dict[str, Any], column_name: str, start_cell_column: int) str
Function that gets a column letter for a column in a Table.
Parameters
- table_referencedict
A Table’s reference attribute.
- column_namestr
The name of the column of interest.
- start_cell_columnint
The index of the Table’s starting cell.
Returns
- column_letter: str
The reference letter for the column.
- chromaquant.utils.formula_tools.get_table_start_coords(table_reference: dict[str, Any]) tuple[int, int]
Function that returns the starting row and column of a table.
Parameters
- table_referencedict[str, Any]
A Table’s reference attribute.
Returns
- start_rowint
The starting row index.
- start_columnint
The starting column index.
- chromaquant.utils.formula_tools.get_value_reference_string(value_reference: dict[str, Any]) str
Function that constructs a value’s cell reference from its reference attribute.
Parameters
- value_referencedict[str, Any]
A Value’s reference attribute.
Returns
- reference: str
A constructed cell reference.
- chromaquant.utils.formula_tools.replace_insert(formula: str, raw: str, reference: str) str
Function that returns a formula after replacing some passed substring with another substring.
Parameters
- formulastr
Formula containing a substring to be replaced.
- rawstr
Substring to be replaced.
- referencestr
Substring to substitute for raw.
Returns
- new_formulastr
Formula after substring replacement.
- chromaquant.utils.formula_tools.table_column_to_range(table_reference: dict[str, Any], column_name: str) str
Function that gets a Table column’s range string.
Parameters
- table_referencedict[str, Any]
A Table’s reference attribute.
- column_namestr
The name of a column of interest in Table.
Returns
- column_rangestr
Range for Table column.