Skip to content

Credentials for Google Sheets on Google Cloud

Before you Start

Enable the API!

Find the Settings for Google Sheets, in the API library

The API Library in the Google Cloud console, searched for sheets, returning the Google Sheets API

If the API is enabled, we're all set, if not, Enable the API

In the screenshot below, it is already enabled.

Product details for the Google Sheets API, showing the status API Enabled

Service Account

Disclaimer

How to setup the Service Account on Google Cloud might change over time.

Go to Google Cloud Console.

Go to API and Services

The Quick access panel on the console home page, with the APIs and services card

Go to Credentials, and create a new Service account. Go through all steps.

The Create credentials menu on the Credentials page, pointing at Service account

You now have the Service Account credentials.

The Credentials page with the new entry listed under Service Accounts

If you have not done during the initial creation, go to the created credentials, and add a private KEY.

Create a private key, in the Keys section.

The Keys tab of a service account, with the Add key menu open on Create new key

Choose JSON format

The Create private key dialog, with JSON chosen over P12 as the key type

After confirmation, a JSON file will be downloaded to your computer. (see example below)

Below is an example (where actual credentials have been removed for security). Below, we'll refer to parts of that JSON to use in the setup.

{
  "type": "service_account",
  "project_id": "your-project-name",
  "private_key_id": "2d7f5c97ccae8465e708bc...",
  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADqsdfkjqmsdlkfjmsqdkfjtyTXDMR\n42AQ7VJsIxnPM5FUZx8xzRNMVDQakle5Ksi6zFeZr3/Nrh20yXp0iYXtkLqNTvAD\n...\nXwbYE9GufVHVtvXz573fQcQzrPJ5ifjoZ+hDpfpT9ZOfMO1zA/HzOlxfUN9XF2Kc\njfFdOCixWLT6HuKeOb0GH1eo\n-----END PRIVATE KEY-----\n",
  "client_email": "google-generated-address@your-project-name.iam.gserviceaccount.com",
  "client_id": "123456789123456798",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/yourname%40yourproject-grafx.iam.gserviceaccount.com",
  "universe_domain": "googleapis.com"
}

OAuth 2.0 Client ID Credentials

Go to Google Cloud Console

Choose API and services > Credentials

Start creation of OAuth client ID

The Create credentials menu on the Credentials page, pointing at OAuth client ID

Important to set an Authorised redirect URI

The Client ID for Web application page, with one entry filled in under Authorised redirect URIs

It should be set to this URI

https://{ENVIRONMENT}.chili-publish.online/grafx/api/v1/environment/{ENVIRONMENT}/connectors/{CONNECTOR_ID}/auth/oauth-authorization-code/redirect

Where: {ENVIRONMENT} = Environment Key

Where is the Environment Key?

Open GraFx Publisher (on CHILI GraFx), and take the Key from the URI, it's the first element.

The GraFx Publisher tile in CHILI GraFx, with its tooltip showing on hover

Below is an example, your Environment Key will be unique to your setup.

A GraFx Publisher browser tab, with the first part of the address, the Environment Key, boxed in red

Set the {CONNECTOR_ID} to the ID of your Connector Instance

You can grab the connector ID from the URI, if you are in the Connector setup (in CHILI GraFx)

The Connectors list under Environments, pointing at the Google Sheets connector instance

Close-up of the address bar, with the connector ID after settings/connectors boxed in red

At the end, you'll get a JSON file. We'll refer to elements in the setup below.

A secured example to use as reference: 1

{
"web":
    {
    "client_id":"123456789.apps.googleusercontent.com",
    "project_id":"your-project-id",
    "auth_uri":"https://accounts.google.com/o/oauth2/auth",
    "token_uri":"https://oauth2.googleapis.com/token",
    "auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs",
    "client_secret":"ABCDEF-_DEF123456HIJKLM"
    }
}

  1. Goes without saying, these settings will NOT work, you need to make your own.