Skip to main content
Skip table of contents

How to Use Client Credentials to Connect to Google Sheets

Marketplace provides an environment variable related to Google Cloud which can be used to connect to any google cloud api, including Google Sheets:

  • ALLI_GOOGLE_CLOUD_CREDENTIALS this is a file path. The file contains credential info that can be passed into google.auth.aws.Credential

PY
from google.auth import aws as google_aws
from googleapiclient.discovery import build as google_build

credentials = google_aws.Credentials.from_file(
    os.environ['ALLI_GOOGLE_CLOUD_CREDENTIALS'],
    scopes=['https://www.googleapis.com/auth/spreadsheets.readonly'],
)

sheets = google_build('sheets', 'v4', credentials=credentials)

Grant Access to the Client Service Account in the Google Sheet

You’ll need to “invite” the client IAM service account to the gsheet you wish it to access. These service accounts take the format alliclient-{randomString}@{projectName}.iam.gserviceaccount.com. You can find this service account by clicking the User Bubble in upper right corner and accessing the Manage Client -> Settings -> Application Settings. Reach out to the DevOps teams if you still need help figuring this out.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.