如何使用Python将Google表单链接到Google工作表?
以下是我的设置和我想要完成的:如何使用Python将Google表单链接到Google工作表?,python,google-sheets,google-drive-api,google-forms,pydrive,Python,Google Sheets,Google Drive Api,Google Forms,Pydrive,以下是我的设置和我想要完成的: 我目前有一个谷歌表单,供用户提交信息,然后登录到谷歌表单中 然后,我使用PyDrive将Google工作表的内容保存为csv Pandas然后读取该csv,并根据特定标准删除csv中的数据 在那之后,我使用PyDrive将“固定”csv重新上传到Google工作表,保存旧的csv 问题是: 每当我这样做时,它就会终止Google表单和Google表单之间的链接。有什么方法可以保留此链接或重新链接表单和工作表 下面是我一直在玩的代码片段: submissions
- 我目前有一个谷歌表单,供用户提交信息,然后登录到谷歌表单中
- 然后,我使用PyDrive将Google工作表的内容保存为csv
- Pandas然后读取该csv,并根据特定标准删除csv中的数据
- 在那之后,我使用PyDrive将“固定”csv重新上传到Google工作表,保存旧的csv
submissions_data = drive.CreateFile({'id': ext['SUBMISSIONS_ID']})
submissions_data.GetContentFile("data.csv", mimetype = "text/csv")
df = pd.read_csv("data.csv")
df.drop([0],inplace=True)
df.to_csv("data.csv", index=False)
submissions_data.SetContentFile("data.csv")`
最好是,我想找到一种使用PyDrive实现这一点的方法,但在这一点上,任何东西都可以工作。感谢您的帮助!谢谢大家! 将Google Drive API与oauth2client和gspread一起使用,直接更新现有的电子表格
sheet.update_cell(1, 1, "I just wrote to a spreadsheet using Python!")
也可以在电子表格中插入一行:
row = ["I'm","inserting","a","row","into","a,","Spreadsheet","with","Python"]
index = 1
sheet.insert_row(row, index)
查看这些函数以及几十个其他函数的完整详细信息。您是在创建新文件而不是更新现有文件吗?@DaImTo我肯定是的,但我认为这是我能根据
sheet.update_cell(1, 1, "I just wrote to a spreadsheet using Python!")
row = ["I'm","inserting","a","row","into","a,","Spreadsheet","with","Python"]
index = 1
sheet.insert_row(row, index)