visual_viper.dataset_builders package
Submodules
visual_viper.dataset_builders.abstract_dataset_builder module
visual_viper.dataset_builders.gs_dataset_builder module
- class visual_viper.dataset_builders.gs_dataset_builder.GoogleSpreadsheetDatasetBuilder(file_id=None, sa_path=None)[source]
Bases:
AbstractDatasetBuilder
The GoogleSpreadsheetDatasetBuilder class is responsible for building datasets from Google Sheets using named ranges. It leverages the gspread library to interact with the Google Sheets API.
- Attributes:
DEFAULT_SA_PATH (str): The default path to the service account credentials JSON file. DEFAULT_SCOPES (list): The default OAuth 2.0 scopes required for authentication.
- Methods:
__init__(sa_path=None): Initializes the dataset builder, authenticating with Google Drive. build_dataset(params, ws_index=0): Builds and returns a dataset based on the given parameters.
- DEFAULT_SA_PATH = './service_account.json'
- DEFAULT_SCOPES = ['https://www.googleapis.com/auth/drive']
- build(params=None, ws_index=0)[source]
Builds and returns a dataset based on the provideparameters, including named ranges and an optional worksheet index
- Args:
params (dict): Dictionary containing requireparameters such as file_id and ranges. ws_index (int, optional): Index of the worksheet tbe used (default is 0)
- Returns:
Dataset: A dictionary containing the retrieved datmapped by named ranges.