Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 2.06 KB

Google_Service_Account_Setup.md

File metadata and controls

26 lines (19 loc) · 2.06 KB

TheVentureCity

Set up a Google Service Account

A two-minute primer to configure your Google account and Google Sheets to enable writing the results of the Python scripts with server-side authentication

Set up the service accont and download a credentials file

To set up a service account and download a credentials file, follow these instructions (steps 1-6 are shown in the gif below):

  1. Go to the Google APIs Console (see first gif below for steps 1-6)
  2. Create a new project
  3. Click Enable API, then search for and enable the Google Sheets API
  4. Create credentials for a Web Server to access Application Data
  5. Name the service account and grant it a Project Role of Editor
  6. Download the JSON file (Caution! This can happen with little warning)

Configure config.ini and the Google Sheet to know about the credentials file and the email address inside it

  1. Copy the JSON file to the same folder as your Python script and refer to it by name from config.ini as the GOOGLE_CREDENTIALS_FILE variable
  2. While you're there, also write the Google Sheets spreadsheet key to config.ini as the GOOGLE_SPREADSHEET_KEY variable. Get it from the URL of the Google Sheet. Example: https://docs.google.com/spreadsheets/d/**16VZFD8XNWbc2mjnzj4jbYiRf3GCu-CDcAq4CVi4RXB0**/edit#gid=0
  3. Find the client_email inside the json file. Back in the Google Sheets spreadsheet that you want to write to, click the Share button in the top right, paste the client email into the People field to give it edit rights, and hit Send (see second gif below)

Credits

This borrows heavily from Greg Baugues's post on Twilio.com