ggvlib.google.sheets

Attributes

DEFAULT_SCOPES

Functions

_client(→ googleapiclient.discovery.Resource)

get_range(→ Dict[str, str])

Returns a dictionary containing data for a range of a sheet

get_range_as_df(→ pandas.DataFrame)

Returns a dictionary containing data for an entire sheet

update_range(→ Dict[str, str])

update_range_from_df(→ Dict[str, str])

Updates data in a specified sheet range using a DataFrame

excel_col_value(→ int)

Gets the numerical index of a Google Sheets / Excel column

excel_cols()

Returns alphabetical indexes for Google Sheets / Excel columns

Module Contents

ggvlib.google.sheets.DEFAULT_SCOPES = ['https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/drive.file',...
ggvlib.google.sheets._client() googleapiclient.discovery.Resource
ggvlib.google.sheets.get_range(sheet_id: str, sheet_range: str) Dict[str, str]

Returns a dictionary containing data for a range of a sheet

Parameters:
  • sheet_id (string) – The id of sheet to gather data from (can be found in the URL)

  • sheet_range (string) – The range to gather data from; using only the sheet name will return the entire sheet

Returns:

The resulting data

Return type:

Dict[str, str]

>>> get_range(sheet_id="example_id", sheet_range="Sheet1!A1:D2")
{'range': 'Sheet1!A1:D2', 'majorDimension': 'ROWS', 'values': [['a', 'b', '1', '2'], ['4', '5', '3', '4']]}
ggvlib.google.sheets.get_range_as_df(sheet_id: str, sheet_range: str, header_row=0) pandas.DataFrame

Returns a dictionary containing data for an entire sheet

Parameters:
  • sheet_id (string) – The id of sheet to gather data from (can be found in the URL)

  • sheet_range (string) – The range to gather data from; using only the sheet name will return the entire sheet

  • header_row (int) – The index of the row to use as a header for the DataFrame

Returns:

The resulting data

Return type:

pd.DataFrame

ggvlib.google.sheets.update_range(sheet_id: str, sheet_range: str, values: List[list]) Dict[str, str]
ggvlib.google.sheets.update_range_from_df(sheet_id: str, range_start: str, df: pandas.DataFrame) Dict[str, str]

Updates data in a specified sheet range using a DataFrame

Parameters:
  • sheet_id (string) – The sheet to update data in

  • range_start (string) – The upper left corner of the sheet

  • df (pd.DataFrame) – A DataFrame to update the sheet with

Returns:

The updated data

Return type:

Dict[str, str]

ggvlib.google.sheets.excel_col_value(column_letter_value: str) int

Gets the numerical index of a Google Sheets / Excel column

Parameters:

column_letter_value (str) – The column letter ie AB

Returns:

The index

Return type:

int

ggvlib.google.sheets.excel_cols()

Returns alphabetical indexes for Google Sheets / Excel columns

Yields:

_type_ – _description_