How To Get Credentials for Google Sheets

Alexander Marenkov
3 min readFeb 8, 2020

--

In this tutorial, I’m going to show you how to get credentials for working with Google Sheets (step by step with screenshots :) ).

It might look a little bit different for you, because Google changes UI sometimes, but it should be helpful anyway. So let’s get started :)

  1. Go to https://console.developers.google.com
  2. Choose the project you’d like to use for accessing Google Sheets if you don’t have one, you’ll need to create it.
Press ‘Select a project’ to select or create a project
Select a Project here or press ‘NEW PROJECT’ to create it
Enter Project name (Location is optional), then press ‘CREATE’

3. As the next step you need to enable Google Drive API and Google Sheets API. Press menu button and go to the library as shown below.

Look for Google Drive API and select it
Press ‘Enable’ to enable it :)
Then look for Google Sheets API and enable it as well

Why do you need Google Drive API? You’ll need it if you want to be able to manage spreadsheet programmatically (such as sharing with other users).

4. Now you can start creating credentials. Press menu and go to credentials.

Press ‘CREATE CREDENTIALS’ and select ‘Service account’
Here you need to enter ‘Service account name’ and ‘Service account ID’, then press ‘CREATE’
‘Service account permissions’ are optional you can press ‘CONTINUE’ here
At the last step you will create the key, so press ‘CREATE KEY’ :)
Select ‘JSON’ and press ‘CREATE’ — credentials should start downloading, save them. That’s the file you’ll use in your project.

After creating the key, press done and you return to the list of credentials.

5. Now comes your last, but very important step — you need to give permission to access the spreadsheet to the service account.

Copy email address of the service account you’ve created and go to the spreadsheet you want to access programmatically
Press ‘SHARE’ and paste the email address you’ve copied

And that’s it! Now you have Google Sheets credentials with access to the spreadsheet. You can start coding now :)

Cheers!

Photo by Wil Stewart on Unsplash

--

--