autodrive.range
¶
Module Contents¶
Classes¶
Provides a connection to the data in a specific range in a Google Sheet Tab. |
- class autodrive.range.Range(gsheet_range, gsheet_id, tab_title, tab_id, *, auth_config=None, sheets_conn=None, autoconnect=True)¶
Provides a connection to the data in a specific range in a Google Sheet Tab.
- Parameters
gsheet_range (FullRange | str) – The range (i.e. A5:C10) to associate with this Range.
gsheet_id (str) – The id string of the target Google Sheet that the Range resides in; can be found in the Google Sheet url.
tab_title (str) – The name of the Tab this Range is within.
auth_config (AuthConfig, optional) – Optional custom AuthConfig, defaults to None.
sheets_conn (SheetsConnection, optional) – Optional manually created SheetsConnection, defaults to None.
autoconnect (bool, optional) – If you want to instantiate a Range without immediately checking your authentication credentials and connection to the Google Sheets api, set this to False, defaults to True.
tab_id (int) –
- property format_grid(self)¶
- Returns
An object with grid formatting methods.
- Return type
- property format_text(self)¶
- Returns
An object with text formatting methods.
- Return type
- property format_cell(self)¶
- Returns
An object with cell formatting methods.
- Return type
- get_data(self, value_type=EffectiveVal)¶
Gets the data from the cells of this Range.
Note
This method will cause a request to be posted to the relevant Google API immediately.
- Parameters
value_type (GoogleValueType, optional) – Allows you to toggle the type of the values returned by the Google Sheets API. See the
dtypes
documentation for more info on the different GoogleValueTypes.- Returns
This Range.
- Return type
- write_values(self, data)¶
Adds a request to write data. Range.commit () to commit the requests.
- Parameters
data (Sequence[Sequence[Any] | Dict[str, Any]]) – The data to write. Each sequence or dictionary in the passed data is a row, with each value in that sub-iterable being a column. Dictionary keys will be used as a header row in the written data.
- Returns
This Tab.
- Return type