I want to add a line to the google sheet document with python. But for some reason it doesn't work I always find this error:
Traceback (most recent call last):
File "D:\Utente\Desktop\BLS-Bonus-Nov-2019-v2\spreadsheet.py", line 27, in <module>
sheet.add_rows(row,1)
TypeError: add_rows() takes 2 positional arguments but 3 were given
i am using this code:
import gspread
from oauth2client.service_account import ServiceAccountCredentials
from pprint import pprint
scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"]
creds = ServiceAccountCredentials.from_json_keyfile_name("GymBot_database.json", scope)
client = gspread.authorize(creds)
sheet = client.open("GymBot_sheet").sheet1 # Open the spreadhseet
row = sheet.row_values(2) # Get a specific row
insertRow = ["hello", 5, "red", "blue"]
sheet.add_rows(row,1)# Insert the list as a row at index 1
this code is not really mine I copied it from this link, to do some tests. But in my case it doesn't work and I don't know why.