https://github.com/leogregianin/google-sheets-api-samples
Google Sheets API Samples
https://github.com/leogregianin/google-sheets-api-samples
Last synced: 4 months ago
JSON representation
Google Sheets API Samples
- Host: GitHub
- URL: https://github.com/leogregianin/google-sheets-api-samples
- Owner: leogregianin
- License: mit
- Created: 2022-05-09T16:32:50.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-06T21:52:39.000Z (over 2 years ago)
- Last Synced: 2024-12-27T21:43:24.914Z (5 months ago)
- Language: Python
- Homepage:
- Size: 33.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Google Sheets API Samples
## Prerequisites
* Create a Google Cloud Platform project with the API enabled. To create a project and enable an API, refer to https://developers.google.com/workspace/guides/create-project
* Create Authorization credentials with OAuth client ID in https://developers.google.com/workspace/guides/create-credentials#oauth-client-id
## Install the Google client library
* `pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib`
## Configure Google Sheets API credentials
Rename `credentials_sample.json` to `credentials.json` and fill in the following fields `client_id`, `project_id` and `client_secret`, or
Download json credentials file directly from `Google Cloud Platform > API Services > Credentials > OAuth client ID`.
## Run the samples
Change `SPREADSHEET_ID` to the ID of the Google Sheets spreadsheet you want to use.
* `python sheets_read.py` to read sheet data
* `python sheets_write.py` to write sheet data