简体   繁体   English

每天从原始表格更新新的 Google 表格

[英]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例如

  • Day 1: 5 new rows imported from a spreadsheet第 1 天:从电子表格导入 5 个新行
  • Day 2: 5 new rows imported from a spreadsheet第 2 天:从电子表格导入 5 个新行
  • Day 3: 10 new rows imported from a spreadsheet第 3 天:从电子表格导入 10 个新行
  • Day 4: 15 new rows imported from a spreadsheet第 4 天:从电子表格导入 15 个新行
  • Day 5: 30 new rows imported from a spreadsheet第 5 天:从电子表格导入 30 条新行

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 的凭据:

  1. Google Drive API > Enable > Create Credentials Google Drive API > 启用 > 创建凭据
  2. Select Google Drive API > Web Server > Application Data > No I'm not using them Select Google Drive API > Web 服务器 > 应用程序数据 > 不,我没有使用它们
  3. Any name > Editor > JSON任意名称 > 编辑器 > JSON
  4. Download JSON credentials > Copy client_email > Share to this email in Google Sheets下载 JSON 凭据 > 复制 client_email > 在 Google 表格中共享到此 email

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.

相关问题 从 forms 更新 Google 表 - Update Google sheet from forms 使用 Google 脚本从 Google 表格上的特定单元格命名新表格 - Naming a New Sheet with Google Scripts from a specific cell on a Google Sheet Google表格中来自我服务器的更新数据 - Google Sheet update data from my server 从 python 脚本更新谷歌表 - Update google sheet from python script 通过表单限制创建新的Google表格 - Create new Google Sheet from Form Respoinses 更新到 Google 表格 - Update to Google Sheet Google 表格 - 引用另一张表格“DataSheet:A1.A”中的数据希望能够导入新表格并更新该参考..? 最好的办法? - Google Sheets - referencing data from another sheet "DataSheet!A1:A" want to be able to import a new sheet and update that reference... best way? 将Google工作表转换为PDF,然后每天发送电子邮件 - Convert google sheet to PDF then email daily 使用 importxml 在 Google 表格中创建每日投资组合跟踪器 - Create a daily portfolio tracker in Google Sheet, with importxml AppScript Google Sheets:将结账表中的序列号匹配到主表,然后更新主表中的单元格 - AppScript Google Sheets: Match Serial #s from checkout sheet to the main sheet then update cells in main sheet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM