External sources

Google Drive

Take over documents from a folder in Google Drive or a shared drive – with a service account in Google Cloud.

With the Google Drive system type, DDM fetches the files from one folder in Google Drive – in a person's „My Drive" or in a shared drive – including its sub-folders, and keeps them up to date. Google Docs, Sheets, Slides and Drawings arrive as PDF.

DDM signs in with a service account – a Google account for programs, not for people. You share the folder with this service account as you would with a colleague, and DDM reads it. Nobody has to sign in to Google in DDM.

Available from the Professional plan – see Plans.

1. Create a service account

This is done in the Google Cloud console with an account that may manage projects there.

Choose a project

At the top, choose a project or create one, e.g. ddm-import.

Enable the Google Drive API

Go to APIs & Services › Library, search for Google Drive API and click Enable.

Create the service account

Go to IAM & Admin › Service accounts › Create service account. Give it a name, e.g. ddm-import. It needs no roles in the project – skip those steps and click Done.

Note the service account's e-mail address, e.g. ddm-import@ddm-import.iam.gserviceaccount.com.

Download a key

Open the service account, go to Keys › Add key › Create new key, choose JSON and click Create. Your browser downloads a file – this is the key you will paste into DDM shortly.

Whoever has the key file can read everything shared with the service account. Do not leave it lying around, and delete it once it is stored in DDM – DDM stores it encrypted.
If your organisation does not allow service account keys (the iam.disableServiceAccountKeyCreation policy), your Google Cloud administrator has to make an exception for this project.

2. Share the folder

This is the step most often missed: the service account sees nothing that has not been shared with it.

  • A folder in „My Drive": in Google Drive, right-click the folder › Share › enter the service account's e-mail address › role Viewer › Send. You can switch off the notification – the service account does not read e-mails.
  • A shared drive: add the service account as a member with the Viewer role (in the shared drive › Manage members).

Then copy the folder's address from the browser's address bar, e.g. https://drive.google.com/drive/folders/1AbCdEfGh….

3. Add the source in DDM

Under Settings › External sources, add a source with New source, give it a name and choose Google Drive as the System type.

FieldWhat to enter
Folder (id or link)The folder's address from the browser – or just the ID after it, 1AbCdEfGh…. Either works
Service account key (JSON)The entire content of the downloaded JSON file – open it in a text editor, select everything and paste it. It starts with { "type": "service_account". Stored encrypted, never shown again
Act on behalf of (optional)Leave it empty – unless you use domain-wide delegation
A JSON file for an OAuth client (it contains "installed" or "web") is not a service account key and is refused. It must be the file from Service accounts › Keys.

4. Test the connection

Click Test connection. DDM signs in to Google as the service account and opens the folder.

MessageWhat to do
Connected — “…” is readable.All good – DDM names the folder it found.
The folder or the service account key is still missing.One of the two has not been entered yet.
The service account key cannot be read — please paste the whole content of the JSON file.The key is incomplete or not a service account key. Paste the whole content of the JSON file again.
Google rejected the service account — check the key, whether the Google Drive API is enabled and, with “Act on behalf of”, the domain-wide delegation.Google refused the service account: the key was deleted in the Cloud console, the Google Drive API is not enabled in the project, or with Act on behalf of the domain-wide delegation is missing.
The folder is not readable — is it shared with the service account, and is the ID that of a folder?The folder is not shared with the service account, the ID is wrong, or it belongs to a file rather than a folder.
The address does not answer — check the URL, the port and the firewall.The DDM server cannot reach Google – allow outgoing connections to oauth2.googleapis.com and www.googleapis.com.

5. Import scope and sync

Under Import scope, decide how folders become categories and which files count, sync once with Sync now and switch on Source active – see Overview.

What applies to Google Drive:

  • DDM takes over all files in the folder and its sub-folders. Files in the bin do not count.
  • Google Docs, Sheets, Slides and Drawings arrive as PDF; .pdf is added to the name. If somebody changes the document in Google, the next sync brings a new PDF as a new version.
  • Forms, Sites, Shortcuts and other Google-specific types are skipped.
  • A file is recognised by its file ID. If you rename it in Drive or move it within the shared folder, it remains the same document in DDM; the sync does not change its category.
  • For the File filter, the name counts as it arrives in DDM – so a Google Doc with .pdf at the end.

Acting on behalf of a person

Instead of sharing folders one by one, in a Google Workspace organisation the service account can read everything one particular person sees – with domain-wide delegation. This needs a super admin of your Google Workspace.

  1. Open the key file and note the client_id – a long number.
  2. In the Google Admin console: Security › Access and data control › API controls › Manage Domain Wide Delegation › Add new.
  3. Client ID: the client_id. OAuth scopes: https://www.googleapis.com/auth/drive.readonly. Authorize.
  4. In DDM, enter the person's e-mail address under Act on behalf of (optional), e.g. marketing@company.com.

DDM then reads as this person – the folder must be visible to them, not to the service account. It can take a few minutes until the delegation takes effect.

With domain-wide delegation, the service account could read files on behalf of every person in your domain. Only set it up if sharing individual folders is not enough.