Skip to main content

Overview

Both Google Sheets integration methods require OAuth 2.0 credentials to authenticate with the Google Sheets API. This guide walks through the one-time setup process.

Prerequisites

  • Google account with access to Google Cloud Console
  • Admin permissions to create a new project or access to an existing project

Configuration Steps

Step 1: Enable Google Sheets API

  1. Navigate to Google Cloud Console
  2. Select an existing project or create a new one using the project dropdown
  3. In the search bar, type “Google Sheets API”
  4. Select the Google Sheets API from the results
  5. Click Enable to activate the API for your project

Step 2: Create OAuth 2.0 Credentials

  1. In the left sidebar, navigate to APIs & ServicesCredentials
  2. Click + CREATE CREDENTIALSOAuth client ID
  3. If prompted, configure the OAuth consent screen first:
    • User Type: Select External (unless using Google Workspace)
    • App Information:
      • App name: “Newton Sheets Integration” (or your preferred name)
      • User support email: Your email address
      • Developer contact: Your email address
    • Scopes: No additional scopes needed (defaults are sufficient)
    • Test users: Add your email address
  4. Click Save and Continue through each section

Generate Client ID

  1. Return to Credentials+ CREATE CREDENTIALSOAuth client ID
  2. Application type: Select Desktop app
  3. Name: “Newton Demo Client” (or your preferred identifier)
  4. Click Create

Step 3: Download and Install Credentials

  1. In the OAuth 2.0 Client IDs list, locate your newly created client
  2. Click the Download button (⬇) to download the JSON file
  3. Rename the downloaded file to exactly: credentials.json
  4. Place the file in the appropriate directories:
    • For File-to-Sheets: newton-demos/spreadsheet-analysis/cl-to-sheets
    • For Spreadsheet-Driven: newton-demos/spreadsheet-analysis/spreadsheet-driven
Both integration methods require their own copy of credentials.json in their respective directories.

Step 4: First-Time Authentication

When you run either integration script for the first time:
  1. Your default browser will open automatically
  2. Sign in with your Google account
  3. Review the permissions request
  4. Click Allow to grant access
  5. The script creates token.pickle for future authentication
The token.pickle file stores your authentication token locally. Keep this file secure and do not commit it to version control.

Security Best Practices

File Management

  • Add credentials.json and token.pickle to .gitignore
  • Never commit authentication files to version control