gspread_helpers.range_name#
The following submodules contain methods for generating dynamic range names, i.e. ‘A2:C59’.
For examples, please refer to the Examples section of an individual class or function.
Submodules#
Exceptions and Warnings |
|
Helper method for dynamically creating range names, i.e. 'A2:BR34'. |
|
Configurable constants for controlling column and row limitations. |
Usage#
The row limit for range names in Microsoft Excel is, by default, 1,048,576.
Below, we override that limitation using the override_col_limit
argument
set to True
and by setting source
equal to ‘excel’.
from gspread_helpers import EXCEL_ROW_LIMIT, RangeName
rn = RangeName(
rows=2, cols=2, override_col_limit=True, source="excel"
)
However, we could have also modulated the EXCEL_ROW_LIMIT
constant instead.
EXCEL_ROW_LIMIT = 1_048_580
rn = RangeName(rows=2, cols=1_048_580, source="excel")
print(rn.range_name)
Modulating the header_rows_size
argument looks like this, and returns ‘A3:B4’.
rn = RangeName(rows=2, cols=2, header_rows_size=2)
Finally, if we want to buffer the range name beginning from ‘B’, we may do this, which returns ‘B1:C2’
rn = RangeName(rows=2, cols=2, buffer=1)
Passing ‘B’ to buffer
is equivalent to passing 1, and returns ‘B1:C2’.
rn = RangeName(rows=2, cols=2, buffer="B")