Build simple Python script to read, modify, and update cells in Google Sheets

Job ID: 31406461

Budget: $30 – $250 USD

REQUIRED DELIVERY DATE: 1 day
BUDGET: $30 to $75.00 USD


I am looking for a sample script that will allow a Python script to do the following:

1) Connect to a Google Sheet
2) Read all data from the Google Sheet
3) Take each "employee name" and check list for a new value
4) Add the current date to the data in the "updated_date" field
4) Update the vales in the Google Sheet using the BATCHUPDATE function in order to control the number of requests used in my Google API account.

Here is the sample spreadsheet: https://docs.google.com/spreadsheets/d/1UEYC_VeF3vi90WXXN8xBuIMt9ZzGz5FovMyGAVCVyy8/edit?usp=sharing

Here is an example of the list of dicts that would be used for updating the cells.

```
new_sales = [
{'employee_name': 'Bob',
'current_sales': '12690'},
{'employee_name': 'Fred',
'current_sales': '14448'},
{'employee_name': 'Jan',
'current_sales': '2373'},
{'employee_name': 'Elidia',
'current_sales': '9250'},
# notice that I'm skipping Jill - her sales should remain the same w/ no updated_date.
# This could be an example where my api didn't successfully complete the update value for Jill.
{'employee_name': 'George',
'current_sales': '6265'},
{'employee_name': 'Sally',
'current_sales': '6311'},
{'employee_name': 'Joe',
'current_sales': '11963'},
{'employee_name': 'Nadim',
'current_sales': '5900'},
{'employee_name': 'Jared',
'current_sales': '11813'},
{'employee_name': 'Megan',
'current_sales': '9151'},
{'employee_name': 'Amber',
'current_sales': '6930'},
{'employee_name': 'Fred',
'current_sales': '2830'},
{'employee_name': 'Linda',
'current_sales': '7966'}, # Linda's sales were found, but didn't change. We would still want to write the value
# and the new updated_date
{'employee_name': 'Dave',
'current_sales': '3894'},
{'employee_name': 'Carlos',
'current_sales': '1564'}
]
```

I would prefer that you use either the gsheets or gspread PIP modules; however, I am open to other suggestions if they are well documented.

This sample will be used as a learning tool for my interns.

Thanks.
Related categories: Python Google APIs