changing batchUpdate to update
from google.oauth2 import service_account
from googleapiclient.discovery import build
-from google.api_core.exceptions import GoogleAPICallError
-
SCOPES = ['https://www.googleapis.com/auth/spreadsheets']
SPREADSHEET_ID = '1kvHv1OBCzr9GnFxRu9RTJC7jjQjc9M4rAiDnhyak2Sg'
+
+# cell containing the total number of entries in the sheet
+# so that we know where the new entry has to be added
NUM_ENTRIES_CELL = 'N4'
CREDENTIALS_PATH = ('./gsheet/creds.json')
@@ -17,7 +18,7 @@ def _get_sheets_service_client():
def write_to_google_sheet(worksheet: str, data) -> None:
- """Call the API to update the values of a sheet and cell range.
+ """Calls the API to update the values of a sheet.
"""
sheets_client = _get_sheets_service_client()
spreadsheet_response = sheets_client.spreadsheets().values().get(
@@ -33,3 +34,4 @@ def write_to_google_sheet(worksheet: str, data) -> None:
'values': data
},
range='{}A{}'.format(worksheet, entries+2)).execute()
+
