route1io_connectors.google.gsheets module
Google Sheets connectors
This module contains functions for interacting with Google Sheets
- clear_google_sheet(gsheets_conn: googleapiclient.discovery.Resource, spreadsheet_id: str, spreadsheet_name: str) None
Clear specified Google Sheet
- gsheets_conngoogleapiclient.discovery.Resource
Connection to Google Sheets API
- spreadsheet_idstr
ID of the Google Sheets spreadsheet
- spreadsheet_namestr
Specific name of Google Sheet to be cleared
- connect_to_gsheets(credentials: google.oauth2.credentials.Credentials) googleapiclient.discovery.Resource
Return a connection to Google Sheets
- Parameters
credentials (google.oath2.credentials.Credentials) – Valid Credentials object with necessary authentication
- Returns
gsheets – Connection to Google Sheets API
- Return type
googleapiclient.discovery.Resource
- download_gsheets_spreadsheet(gsheets_conn: googleapiclient.discovery.Resource, filename: str, spreadsheet_id: str, spreadsheet_name: str) None
Download a file from a specified Google Sheet
- Parameters
gsheets_conn (googleapiclient.discovery.Resource) – Connection to Google Sheets API
filename (str) – Name of the local filename to download to
spreadsheet_id (str) – ID of the Google Sheet to download from
spreadsheet_name (str) – Name of the specific Sheet to write to
- upload_gsheets_spreadsheet(gsheets_conn: googleapiclient.discovery.Resource, filename: str, spreadsheet_id: str, spreadsheet_name: str) None
Clears a Google Sheet and uploads from file to sheet
- Parameters
gsheets_conn (googleapiclient.discovery.Resource) – Connection to Google Sheets API
filename (str) – Name of the file to be uploaded
spreadsheet_id (str) – ID of the Google Sheet to upload to
spreadsheet_name (str) – Name of the specific Sheet to write to