> For the complete documentation index, see [llms.txt](https://docs.labii.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.labii.com/widgets/section-widgets/office/file/google-drive.md).

# Google Drive

## Specs

| Label                     | Value                         |
| ------------------------- | ----------------------------- |
| **Version**               | 1.0.0 (updated on 2021-10-27) |
| **Developer**             | Labii Inc.                    |
| **Type**                  | Section                       |
| **Support Configuration** | Yes                           |

## Overview

The Google Drive widget connects a Labii record to files stored in Google Drive, allowing laboratory teams to browse cloud documents, insert selected files into a section, and preview linked content without leaving the record page. It is useful when protocols, reports, spreadsheets, or supporting documents already live in a Google Workspace environment and need to be referenced from an ELN or LIMS workflow.

{% hint style="warning" %}
This widget does not meet 21 CFR Part 11 requirements. Use it cautiously in regulated workflows that require compliant electronic records and signatures.
{% endhint %}

## Use Cases

* **Protocol References**: Link SOPs, work instructions, and external protocol documents stored in Google Drive to an experiment or quality record.
* **Collaborative Reporting**: Attach Google Docs, Sheets, or Slides that multiple team members maintain outside Labii while keeping the files visible from the record.
* **Project Documentation**: Centralize project files in Google Drive and surface the relevant subset inside Labii records for easier review.
* **File Preview Workflows**: Load previews of linked files during experiment review without downloading or re-uploading the originals.
* **Cloud File Reuse**: Reuse existing Google Drive content instead of duplicating attachments across multiple records.

## Interface

### Read-only View

The read-only view displays the list of Google Drive files that have already been attached to the section. Each item includes the file title and available actions for opening or previewing the linked file. This makes it easy for reviewers and collaborators to access the latest Google-hosted document directly from the record.

* **File Display**: Shows attached Google Drive file titles in a section-level list.
* **Open Access**: Use **Open** to launch the selected file in Google Drive.
* **Preview Loading**: Use **Load Preview** to render a preview of supported files inside the widget.
* **Record Context**: Keeps externally managed documents associated with the current Labii record.

<figure><img src="/files/j7t1G1pl0VTRlNHv28gu" alt=""><figcaption></figcaption></figure>

### Edit View

The edit view adds controls for authorization and file selection. Users can connect their Google account, launch Google Picker, search for files, and add one or more selections to the section. The same view also provides removal controls for cleaning up outdated links.

* **Authorization**: Click **Authorize** the first time you use the widget to grant access to your Google Drive files.
* **File Selection**: Click **Add file** to open Google Picker and search or browse available files.
* **Bulk Insert**: Select one or multiple files in Google Picker and add them to the record in one action.
* **Cleanup**: Remove outdated or incorrect file links directly from the section.

## Configuration

### Initial Setup

{% stepper %}
{% step %}
Create or open a Google Cloud project for your Labii deployment in [Google Cloud Console](https://console.cloud.google.com/)
{% endstep %}

{% step %}
Open **Credentials**, create an API key, and save it as **GOOGLE\_API\_KEY**
{% endstep %}

{% step %}
Configure the **OAuth consent screen**, add **labii.app** as an authorized domain, and publish the app to production
{% endstep %}

{% step %}
Create an OAuth Client ID for a **Web application**, add your Labii domain to **Authorized JavaScript origins**, and save the client ID as **GOOGLE\_CLIENT\_ID**
{% endstep %}

{% step %}
Enable both **Google Drive API** and **Google Picker API**, then copy the project number as **GOOGLE\_APP\_ID**
{% endstep %}

{% step %}
Open the Google Drive widget configuration in Labii, enter the three values, and click **Save**
{% endstep %}
{% endstepper %}

### Required Settings

* **GOOGLE\_APP\_ID**: The Google Cloud project number used by Google Picker.
* **GOOGLE\_CLIENT\_ID**: The OAuth client ID for the web application authorized to access Google Drive.
* **GOOGLE\_API\_KEY**: The API key used to load Google APIs for the widget.

{% hint style="info" %}
Replace **<https://www.labii.app>** with your actual Labii domain when configuring **Authorized JavaScript origins** for regional data centers or dedicated servers, such as **<https://eu.labii.app>**.
{% endhint %}

### Advanced Configuration

{% stepper %}
{% step %}
Review the Google OAuth consent screen and verify that the published app domain matches the Labii domain your users access
{% endstep %}

{% step %}
If users work across multiple Labii environments, create separate OAuth client configurations so each environment has the correct JavaScript origin
{% endstep %}

{% step %}
After updating Google Cloud settings, reopen the widget and re-authorize if Google prompts for renewed consent
{% endstep %}
{% endstepper %}

## Additional Functions

### Authorize Google Access

The first time a user interacts with the widget, they must authorize their Google account so Labii can display Google Drive files through the widget.

{% stepper %}
{% step %}
Open a record that contains the **Google Drive** widget
{% endstep %}

{% step %}
Click **Authorize** in the widget toolbar
{% endstep %}

{% step %}
Sign in with the Google account that matches your intended Google Drive workspace and approve access
{% endstep %}
{% endstepper %}

### Add Files

Use **Add file** to launch Google Picker and attach existing Drive files to the current section.

{% stepper %}
{% step %}
Click **Add file** in the Google Drive widget
{% endstep %}

{% step %}
Search for files or browse folders in Google Picker
{% endstep %}

{% step %}
Select one or more files and confirm the selection to insert them into the section
{% endstep %}
{% endstepper %}

### Preview, Open, and Remove Files

* **Open**: Opens the selected file directly in Google Drive.
* **Load Preview**: Loads an inline preview of supported files within the widget.
* **Remove**: Removes the file reference from the section without deleting the original file from Google Drive.

## Best Practices

### Access and Governance

* Use service ownership rules in Google Workspace so critical project files remain available even if an individual account changes.
* Restrict widget use to teams that already manage collaborative documents in Google Drive to avoid fragmented file storage practices.

### Record Integrity

* Link finalized or review-ready documents to Labii records instead of frequently changing drafts when stable references are required.
* Confirm that file sharing permissions in Google Drive align with your Labii project membership before relying on the widget during collaboration.

### Configuration Management

* Maintain separate Google Cloud credentials for production and testing environments.
* Revalidate OAuth origins whenever your Labii domain changes, such as after moving to a regional data center or dedicated server.

### Migration Note

The previous G Suite widgets are being replaced by the Google Drive widget. Update older templates and record layouts to use Google Drive when you need a single section for linking and previewing Google-hosted files.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.labii.com/widgets/section-widgets/office/file/google-drive.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
