Managing Excel files can be a pain. Imagine you are working on an Excel sheet that you just downloaded from the Google Drive when all of a sudden, a teammate updates the excel file. Now you have to re-download the file all over again! If this has ever happened to you, or you just hate re-uploading and downloading excel files manually, then keep on reading. In this post we are going to learn how to activate the Google Sheets API so we can automate accessing and writing sheets directly from and to the cloud.

First ensure that you have a Google account. Google usually gives free credits, so you will not have to pay for accessing their resources for the first year. Once done, let’s activate the API.

Activating the API

In order to activate this service, we have to tell Google that our account will be using it. So let us google Google Cloud. Then on their website hit the console button. This is where we can see all our account resources. Then in the search bar search for Google Sheets API and then click enable. Once done, also enable the Google Drive API by searching for Google Drive API and repeating the same process.

Great! So now that we’re done activating the API lets set up some service accounts. We’ll then give these service accounts access to certain sheets. Afterwards we’ll write some Python code to access this data.

Creating a Service Account

To create a Service Account we’ll have to go the credentials dashboard. Go to APIs & Services and then Credentials. There we will see page like the one below. Hit the Create Credentials button and then hit the Service Account button. Give it any name you want.

#data-science #google-sheets #google-cloud-platform #python #google-api

Set up Google Sheets API in Minutes
1.90 GEEK