How to read, update, and create a Google spreadsheet and build a DataFrame pandas.

Image for post

Index

  1. Create a project in Google Developers.
  2. Active API Google Sheets and Google Drive.
  3. Keys for authenticating: Local or Service
  4. Create Spreadsheet.
  5. Script Python + Pandas.

Image for post

Create a project in Google Developers

We need to create a project in order to use the Google Sheets API resources.

Nothing works without that project.

Link: https://console.developers.google.com/project

  1. Create a project.

Image for post

2. Set a name for the project.

Image for post


Image for post

Google Sheets API

Now we start API to interchange sheets with the project, then a type of API is chosen: public or a private one.

  1. In the search bar find the “Google Sheets API”.

Image for post

2. Set an “Enable” option.

Image for post](https://miro.medium.com/max/600/1*jtTBUo0BZcqQHQUY4m6dyQ.png)

3. Come back to the main page and choose “OAuth consent screen”.

Image for post

4. We need to define what type of API is chosen; the public one allows any person to access your API, the private one is accessed only by the user who has the code.

In this example, the public API has been chosen.

Image for post

5. After selecting a type, a name for the API has to be set.

There are other options; for this example it is not necessary to set it.

Image for post

6. Enable the Google Drive API.

Image for post

#spreadsheets #python #google #pandas

Python + Pandas + Google SpreadSheet
1.30 GEEK