with open("a.txt", "r") as a:
try:
b = a.readlines()[2]
wks = gc.open('Test').sheet1
if b not in open('c.txt').read():
check = "True"
wks.append_row(['test', 'test'])
print("Spreadsheet appended.")
with open("c.txt", "a") as c:
c.write(blah_blah+"\n")
else:
check = "False"
do_x()
except:
pass
当前,仅在重新启动脚本后才添加电子表格。我想将脚本自动添加到电子表格中,但是我不确定错误在哪里!
编辑:删除try / except后12小时左右返回此错误。
gspread.exceptions.APIError: {
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}