Cell Reference Functions

numbers_parser.xl_cell_to_rowcol(cell_str: str) tuple[source]

Convert a cell reference in A1 notation to a zero indexed row and column.

Parameters:

cell_str (str) – A1 notation cell reference

Returns:

row, col – Cell row and column numbers (zero indexed).

Return type:

int, int

numbers_parser.xl_range(first_row, first_col, last_row, last_col)[source]

Convert zero indexed row and col cell references to a A1:B1 range string.

Parameters:
  • first_row (int) – The first cell row.

  • first_col (int) – The first cell column.

  • last_row (int) – The last cell row.

  • last_col (int) – The last cell column.

Returns:

A1:B1 style range string.

Return type:

str

numbers_parser.xl_rowcol_to_cell(row, col, row_abs=False, col_abs=False)[source]

Convert a zero indexed row and column cell reference to a A1 style string.

Parameters:
  • row (int) – The cell row.

  • col (int) – The cell column.

  • row_abs (bool) – If True, make the row absolute.

  • col_abs (bool) – If True, make the column absolute.

Returns:

A1 style string.

Return type:

str

numbers_parser.xl_col_to_name(col, col_abs=False)[source]

Convert a zero indexed column cell reference to a string.

Parameters:
  • col (int) – The column number (zero indexed).

  • col_abs (bool, default: False) – If True, make the column absolute.

Returns:

Column in A1 notation.

Return type:

str