【发布时间】:2021-05-26 23:35:41
【问题描述】:
我正在尝试将 CSV 导入 Google 工作表(这工作正常)
在此之后,我希望工作表中的所有单元格都换行。
我尝试了多种不同的方法,但是,我总是遇到某种错误。
这是我正在运行的代码:
import gspread
gc = gspread.service_account(filename='C:/pathtomyfile.json')
sh = gc.open("gsheetsname")
worksheet = sh.get_worksheet(0)
content = open('csvfilename.csv', 'rb').read()
gc.import_csv(sh.id, content)
worksheet.format("A:E", {"wrapStrategy": "WRAP"})
我似乎遇到的错误大致如下: gspread.exceptions.APIError:
{'code': 400, 'message': 'Invalid requests[0].repeatCell: No grid with id: 828077185', 'status': 'INVALID_ARGUMENT'}
我尝试重命名谷歌工作表,重命名工作表,尝试不同的模块,还尝试导入 gspread-formatting,但似乎没有任何效果
【问题讨论】:
标签: python csv google-sheets google-sheets-api gspread