简体   繁体   中英

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
  • Day 2: 5 new rows imported from a spreadsheet
  • Day 3: 10 new rows imported from a spreadsheet
  • Day 4: 15 new rows imported from a spreadsheet
  • Day 5: 30 new rows imported from a spreadsheet

Any help is appreciated.

I believe the question would be the method to interact with Google Sheet with eg Python.

1) Install 2 packages:

python3 -m pip install --user gspread oauth2client

2) Google Drive API (Google Cloud Platform)

Credentials for Google Drive API:

  1. Google Drive API > Enable > Create Credentials
  2. Select Google Drive API > Web Server > Application Data > No I'm not using them
  3. Any name > Editor > JSON
  4. Download JSON credentials > Copy client_email > Share to this email in Google Sheets

3. Google Sheets API (Google Cloud Platform)

Google Sheets API > Enable

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 .

Reference: 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM