Represents the address of a cell. This can also be unbound in an axes. So ‘A’ is also a valid address but this requires explict setting of param allow_non_single. Integer Indexes start from 1.
>>> a = Address('A2') >>> a.label A2 >>> a 1 >>> a 2 >>> a = Address((1, 2)) >>> a.label A2 >>> a + (0,1) <Address B2> >>> a == (2, 2) True >>> a = Address((None, 1), True) <Address A> >>> a = Address('2', True) <Address 2>
Label of the current address in A1 format.
Row of the address
Column of the address
Current Address in tuple format. Both axes starts at 1.
GridRange(label=None, worksheet=None, start=None, end=None, worksheet_title=None, worksheet_id=None, propertiesjson=None)¶
Represents a rectangular (can be unbounded) range of adresses on a sheet. All indexes are one-based and are closed, ie the start index and the end index is inclusive Missing indexes indicate the range is unbounded on that side.
A:B, A1:B3, 1:2 are all valid index, but A:1, 2:D are not
grange.start = (1, None) will make the range unbounded on column grange.indexes = ((None, None), (None, None)) will make the range completely unbounded, ie. whole sheet
>>> grange = GridRange(worksheet=wks, start='A1', end='D4') >>> grange <GridRange Sheet1!A1:D4> >>> grange.start = 'A' # will remove bounding in rows <GridRange Sheet1!A:D> >>> grange.start = 'A1' # cannot add bounding at just start <GridRange Sheet1!A:D> >>> grange.indexes = ('A1', 'D4') # cannot add bounding at just start <GridRange Sheet1!A1:D4> >>> grange.end = (3, 5) # tuples will also work <GridRange Sheet1!A1:C5> >>> grange.end = (None, 5) # make unbounded on rows <GridRange Sheet1!1:5> >>> grange.end = (None, None) # make it unbounded on one index <GridRange Sheet1!1:1> >>> grange.start = None # make it unbounded on both indexes <GridRange Sheet1> >>> grange.start = 'A1' # make it unbounded on single index,now AZ100 is bottom right cell of worksheet <GridRange Sheet1:A1:AZ100>
Reference: GridRange API docs
address of top left cell (index).
address of bottom right cell (index)
Indexes of this range as a tuple
Label in A1 notation format
Id of woksheet this range belongs to
Title of woksheet this range belongs to
- create a Gridrange from various type of data
- data – can be string in A format,tuple or list, dict in GridRange format, GridRange object
- wks – worksheet to link to (optional)
set the worksheet of this grid range.
Get json representation of this grid range.
Apply a Gridrange json to this named range.
Parameters: namedjson – json object of the GridRange format
Reference: GridRange docs
get bounded indexes of this range based on worksheet size, if the indexes are unbounded
Height of this gridrange
Width of this gridrange