Skip to content

Google Drive

Where: Menu → Manage → Knowledge sources → Connectors → Add connector → “Google Drive”

This connector reads folders in My Drive and in shared drives of your Google Workspace through the Drive API. Google Docs arrive as text with their structure, Slides as text and Sheets as a table; PDFs, Office files and the like are read by the portal (or next to the connector, with “Text only”). After the first run it fetches only what changed.

It signs in with a service account of your own Google Cloud project, which your Workspace administrator allows to read on behalf of one Workspace account (domain-wide delegation, read-only). It sees exactly what that account sees.

Step Where Who
A project, the Drive API, a service account and its JSON key Google Cloud console Whoever may create projects and service accounts in your Google Cloud organisation
Domain-wide delegation for read-only Drive access Google Admin console A Workspace super administrator
The account the connector reads as, and its access to shared drives Google Admin console, Google Drive A Workspace administrator; a manager of each shared drive
Add the connector and its sources The Academy, Manage → Knowledge sources An administrator of your organisation
  1. Open the Google Cloud console (console.cloud.google.com) and choose or create a project, e.g. academy-knowledge.
  2. APIs & Services → Library: search for Google Drive API and click Enable.
  3. IAM & Admin → Service Accounts → Create service account: a name such as academy-knowledge, Create and continue. It needs no roles in the project: click Done.
  4. Open the service account and copy its Unique ID (a long number, also called the client ID). You need it in step 2.
  5. Tab Keys → Add key → Create new key → JSON → Create. A JSON file downloads. Keep it like a password: it is the sign-in.

2. Allow read-only access (domain-wide delegation)

Section titled “2. Allow read-only access (domain-wide delegation)”
  1. Open the Google Admin console (admin.google.com) as a super administrator.
  2. Security → Access and data control → API controls → Manage Domain Wide Delegation → Add new.
  3. Client ID: the service account’s Unique ID from step 1.
  4. OAuth scopes: exactly https://www.googleapis.com/auth/drive.readonly
  5. Click Authorise. It can take a few minutes, sometimes longer, until Google applies it.

3. Choose the account the connector reads as

Section titled “3. Choose the account the connector reads as”

The connector reads as one Workspace account. Use one meant for this, e.g. a service mailbox knowledge@example.com, rather than a person’s own:

  • Add it as a member (Viewer is enough) of every shared drive you want to connect.
  • Folders in other people’s My Drive are seen only if they are shared with that account.
  1. Manage → Knowledge sources, tab Connectors, Add connector, Kind: “Google Drive”.
  2. Where it runs: Run by the portal (nothing to install), or At your organisation if the key must stay in your network.
  3. Name: e.g. Google Drive.
  4. Read as (Workspace account): the account from step 3, e.g. knowledge@example.com.
  5. Service account key (JSON): paste the whole content of the JSON file from step 1, from { to }. At your organisation it is set where the connector runs, as CONNECTOR_SERVICE_ACCOUNT_KEY with the JSON as its value.
  6. Click Add, then Test. “Works: knowledge@example.com · academy-knowledge@….iam.gserviceaccount.com” names the account it reads as and the service account.
  1. Tab Sources → Add source, choose this connector.
  2. Drive and folder: click Browse…. The first level lists My Drive and the shared drives the account is a member of; Choose one to read all of it, or Open it and choose a folder.
  3. Include and Leave out apply to the path below that folder. By default everything is included.
  4. The rest as for every source (see Sources), then Save and Sync now.
  • Each file’s sharing comes along: people and groups by their address, a whole domain, and “anyone with the link”.
  • Shared with the whole domain or anyone, a file is open to the source’s audience; shared only with people or groups, only they find it.
  • Google groups are matched with your people through the company sign-in with Google; otherwise give them to teams under Access areas.
  • Drive labels arrive as labels. Under Access areas you decide whether one restricts reading.
Message Cause What to do
Google sign-in failed: unauthorized_client The domain-wide delegation is missing, has another client ID or another scope, or isn’t applied yet Step 2 again: the Unique ID and exactly the scope …/auth/drive.readonly; wait a while and Test again
Google sign-in failed: invalid_grant Read as isn’t an account of your Workspace, or is suspended Enter an active account of your domain
the service account key isn’t the JSON key Google offers for download Something else was pasted (the key’s id, a P12 key, part of the file) Paste the whole JSON file
the service account key’s private key can’t be read The JSON was changed or cut while copying Download a new JSON key and paste it unchanged
Google Drive refused access: check the delegation and that the account can open this drive The account isn’t a member of the shared drive, or the Drive API isn’t enabled Add the account to the shared drive; enable the Google Drive API in the project
not found in Google Drive (drive, folder or file) The folder was moved or deleted, or the account lost access Choose the folder again with Browse…
pick a drive and folder Drive and folder wasn’t chosen Click Browse…

Delete the connector in the Academy, then in the Admin console remove the delegation and in the Cloud console delete the key (or the whole service account).