Занесение данных в гугл таблицу

Пытаюсь занести данные в Google таблицу, но выбивает подобную ошибку:

 File "C:\Users\Konstantin\Documents\Visual Studio 2019\Python Scripts\Python 3.7 (64-bit)\lib\site-packages\googleapiclient\http.py", line 937, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://sheets.googleapis.com/v4/spreadsheets?fields=spreadsheetId&alt=json returned "Invalid JSON payload received. Unknown name "type" at 'spreadsheet.properties': Cannot find field.
Invalid JSON payload received. Unknown name "role" at 'spreadsheet.properties': Cannot find field.". Details: "[{'@type': 'type.googleapis.com/google.rpc.BadRequest', 'fieldViolations': [{'field': 'spreadsheet.properties', 'description': 'Invalid JSON payload received. Unknown name "type" at \'spreadsheet.properties\': Cannot find field.'}, {'field': 'spreadsheet.properties', 'description': 'Invalid JSON payload received. Unknown name "role" at \'spreadsheet.properties\': Cannot find field.'}]}]">
Поток 'MainThread' (0x1) завершился с кодом 0 (0x0).
Программа "python.exe" завершилась с кодом 1 (0x1).

Пытался сделать вот по вот этому примеру

Вот сам код:

CREDENTIALS_FILE = 'feisty-enigma-334313-66f9a4e49eff.json'  # имя файла с закрытым ключом
spreadsheets_id = '1ERzuhjKWsUg_WnmQkER5J3YlQVCwwfRB_XNXpxw1YI8'
gscope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']


credentials = ServiceAccountCredentials.from_json_keyfile_name(CREDENTIALS_FILE, ['https://www.googleapis.com/auth/spreadsheets',
                                                                                  'https://www.googleapis.com/auth/drive'])
gdocument = 'test'   
httpAuth = credentials.authorize(httplib2.Http())
service = apiclient.discovery.build('sheets', 'v4', http = httpAuth) 
.
.
.
def add_to_gsheet(message, data, text,
        items: List[Tuple[str, str, str]],
        encoding='utf-8'
        ):

    credentials = ServiceAccountCredentials.from_json_keyfile_name(gscope, CREDENTIALS_FILE)
    gc = gspread.authorize(credentials)
    wks = gc.open(gdocument).sheet1
    wks.append_row(
        [datetime.now().strftime('%d.%m.%Y %H:%M'), 'Name', 'Price', 'Nal', ' '])    
    

Вот полный код программы: https://dpaste.org/v7ef

Если четко сформулировать вопрос, то он звучит так:

Как заносить данные в таблицу с парсера в уже готовую таблицу, а не создавать каждый раз новую?


Ответы (0 шт):