Translator
paper-xlsx 0.2.1 API reference
Modifies a formula so that it can be translated from one cell to another.
formula: The str string to translate. Must include the leading '='
character.
origin: The cell address (in A1 notation) where this formula was
defined (excluding the worksheet name).
Translator(formula, origin)Attributes
CELL_REF_RE
attributeCELL_REF_RE= re.compile('(\\$?[A-Za-z]{1,3})(\\$?[1-9][0-9]{0,6})$')COL_RANGE_RE
attributeCOL_RANGE_RE= re.compile('(\\$?[A-Za-z]{1,3}):(\\$?[A-Za-z]{1,3})$')ROW_RANGE_RE
attributeROW_RANGE_RE= re.compile('(\\$?[1-9][0-9]{0,6}):(\\$?[1-9][0-9]{0,6})$')tokenizer
attributetokenizer= Tokenizer(formula)Functions
get_tokens
funcget_tokens()Returns a list with the tokens comprising the formula.
strip_ws_name
funcstrip_ws_name(range_str)Splits out the worksheet reference, if any, from a range reference.
paramrange_strtranslate_col
functranslate_col(col_str, cdelta)Translate a range col-snippet by the given number of columns
paramcol_strparamcdeltatranslate_formula
functranslate_formula(dest=None, row_delta=0, col_delta=0)Convert the formula into A1 notation, or as row and column coordinates
The formula is converted into A1 assuming it is assigned to the cell
whose address is dest (no worksheet name).
paramdest= Noneparamrow_delta= 0paramcol_delta= 0translate_range
functranslate_range(range_str, rdelta, cdelta)Translate an A1-style range reference to the destination cell.
rdelta: the row offset to add to the range
cdelta: the column offset to add to the range
range_str: an A1-style reference to a range. Potentially includes
the worksheet reference. Could also be a named range.
paramrange_strparamrdeltaparamcdeltatranslate_row
functranslate_row(row_str, rdelta)Translate a range row-snippet by the given number of rows.
paramrow_strparamrdelta