This section walks through setting up the Google Drive connector using a Service Account. More info on Service Accounts can be found here. A Google Workspace is required.

If you’d rather use an individuals account + OAuth to access Google Drive, checkout the section here.

Authorization

  1. Create a Google Cloud Project

  2. Enable the Google Drive API

    • On the left panel, open APIs & services
    • Go to Enabled APIs and services
    • On the top click +ENABLE APIS AND SERVICES
    • Search for Google Drive API and click ENABLE
    • Alternatively visit this link, select your project and enable the Google Drive API

GoogleDriveEnableAPI

  1. Create a Service Account
    • Go to the Service Account management page in Google Cloud.
    • Click Create Service Account button and fill out the fields in step 1. You can ignore steps 2 and 3.
    • Go to the Keys section, and click Add Key. Download this key, you will need to upload to to Danswer later.
  1. Give this Service Account read-only access to Google Drive
    • Copy the Unique ID of the Service Account
    • Go to the Domain-wide Delegation page in the Google Admin Console.
    • Click Add new, fill in the client ID with the Unique ID of the Service Account, and add the https://www.googleapis.com/auth/drive.readonly and https://www.googleapis.com/auth/drive.metadata.readonly scopes.

Indexing

  1. Navigate to the Admin Dashboard and select the Google Drive Connector.
  2. Select the Service Account Key JSON that you downloaded in step (3), then click the Upload button to save your credentials into Danswer.
  3. Optionally select a user to “impersonate” when fetching files.
    • If a user email is provided, then Danswer will have access to all documents that user has access to.
    • If no user email is provided, then Danswer will have access to all documents that the Service Account you created in step (3) has access to. By default, this is no documents. You will have to share the relevant drives / shared drives with the Service Account so that it can pull documents.
  4. Click the Connect button (optionally specifying specific paths that you want to index)! All documents accessible by the account specified in the previous step will now be pulled into Danswer every 10 minutes.