[英]Update new Google sheet daily from orginal sheet
Not sure if this is an obvious answer.不确定这是否是一个明显的答案。 I have a complete sheet with thousands of rows.
我有一张包含数千行的完整表格。 What I need is for a new google sheet to update rows daily from the original sheet.
我需要一个新的谷歌表来每天从原始表中更新行。 For example
例如
Any help is appreciated.任何帮助表示赞赏。
I believe the question would be the method to interact with Google Sheet with eg Python.我相信问题将是与Google Sheet交互的方法,例如 Python。
1) Install 2 packages: 1)安装2个包:
python3 -m pip install --user gspread oauth2client
2) Google Drive API (Google Cloud Platform) 2)谷歌驱动器API(谷歌云平台)
Credentials for Google Drive API: Google Drive API 的凭据:
3. Google Sheets API (Google Cloud Platform) 3.谷歌表格API(谷歌云平台)
Google Sheets API > Enable谷歌表格 API > 启用
4. gspread package 4. gspread package
Get Methods:获取方法:
get_all_records()
row_values(row)
col_values(col)
cell(row, col).value
Insert Methods:插入方法:
insert_row(array, rowNo)
delete_row(rowNo)
update_cell(rowNo, colNo, value)
I shall leave out the details of reading your local spreadsheet as details were not provided.由于未提供详细信息,因此我将省略阅读您本地电子表格的详细信息。 To do this periodically, I suggest you consider running your Python script periodically with Windows Task Scheduler .
要定期执行此操作,我建议您考虑使用Windows Task Scheduler定期运行 Python 脚本。
Reference: https://gspread.readthedocs.io/en/latest/参考: https://gspread.readthedocs.io/en/latest/
ps I used to struggle with this while creating a chatbot for a school project, so the following was what I had done previously. ps 我曾经在为学校项目创建聊天机器人时遇到过这个问题,所以以下是我之前所做的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.