# Google Drive (/integrations/google_drive)





{/* MANUAL-CONTENT-START:intro */}

Use [Google Drive](https://drive.google.com) to manage files, folders, metadata, and permissions. Download and content actions export Google Workspace files; the Export action lets you choose a supported output format.

{/* MANUAL-CONTENT-END */}

## OAuth scopes [#oauth-scopes]

Sim requests these scopes when someone connects a Google Drive account. For a self-hosted deployment, register your own app with the provider using the settings below. See [Integrations and OAuth](/platform/self-hosting/integrations-oauth) for setup.

| Setting | Value |
| - | - |
| Redirect URI | `<NEXT_PUBLIC_APP_URL>/api/auth/oauth2/callback/google-drive` |
| Environment variables | `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET` |

| Scope | Description |
| - | - |
| `https://www.googleapis.com/auth/userinfo.email` | View email address |
| `https://www.googleapis.com/auth/userinfo.profile` | View basic profile info |
| `https://www.googleapis.com/auth/drive.file` | View and manage Google Drive files you open or create with Sim |
| `https://www.googleapis.com/auth/drive` | View, edit, create, and delete all Google Drive files |

## Use the block [#usage-instructions]

Create, upload, download, export, copy, move, delete, or share files and folders, and manage their metadata and permissions.

## Actions [#actions]

### List Google Drive Files [#list-google-drive-files]

List files and folders in Google Drive with complete metadata

<ReferenceDetails>
  #### Input [#input]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `folderSelector` | string | No | Google Drive folder ID to list files from (e.g., 1ABCxyz...) |
  | `folderId` | string | No | The ID of the folder to list files from (internal use) |
  | `query` | string | No | Search term to filter files by name (e.g. "budget" finds files with "budget" in the name). Do NOT use Google Drive query syntax here - just provide a plain search term. |
  | `pageSize` | number | No | The maximum number of files to return (default: 100) |
  | `pageToken` | string | No | The page token to use for pagination |

  #### Output [#output]

  | Parameter | Type | Description |
  | - | - | - |
  | `files` | array | Array of file metadata objects from Google Drive |
  | ↳ `id` | string | Google Drive file ID |
  | ↳ `kind` | string | Resource type identifier |
  | ↳ `name` | string | File name |
  | ↳ `mimeType` | string | MIME type |
  | ↳ `description` | string | File description |
  | ↳ `originalFilename` | string | Original uploaded filename |
  | ↳ `fullFileExtension` | string | Full file extension |
  | ↳ `fileExtension` | string | File extension |
  | ↳ `owners` | json | List of file owners |
  | ↳ `permissions` | json | File permissions |
  | ↳ `permissionIds` | json | Permission IDs |
  | ↳ `shared` | boolean | Whether file is shared |
  | ↳ `ownedByMe` | boolean | Whether owned by current user |
  | ↳ `writersCanShare` | boolean | Whether writers can share |
  | ↳ `viewersCanCopyContent` | boolean | Whether viewers can copy |
  | ↳ `copyRequiresWriterPermission` | boolean | Whether copy requires writer permission |
  | ↳ `sharingUser` | json | User who shared the file |
  | ↳ `starred` | boolean | Whether file is starred |
  | ↳ `trashed` | boolean | Whether file is in trash |
  | ↳ `explicitlyTrashed` | boolean | Whether explicitly trashed |
  | ↳ `appProperties` | json | App-specific properties |
  | ↳ `createdTime` | string | File creation time |
  | ↳ `modifiedTime` | string | Last modification time |
  | ↳ `modifiedByMeTime` | string | When modified by current user |
  | ↳ `viewedByMeTime` | string | When last viewed by current user |
  | ↳ `sharedWithMeTime` | string | When shared with current user |
  | ↳ `lastModifyingUser` | json | User who last modified the file |
  | ↳ `viewedByMe` | boolean | Whether viewed by current user |
  | ↳ `modifiedByMe` | boolean | Whether modified by current user |
  | ↳ `webViewLink` | string | URL to view in browser |
  | ↳ `webContentLink` | string | Direct download URL |
  | ↳ `iconLink` | string | URL to file icon |
  | ↳ `thumbnailLink` | string | URL to thumbnail |
  | ↳ `exportLinks` | json | Export format links |
  | ↳ `size` | string | File size in bytes |
  | ↳ `quotaBytesUsed` | string | Storage quota used |
  | ↳ `md5Checksum` | string | MD5 hash |
  | ↳ `sha1Checksum` | string | SHA-1 hash |
  | ↳ `sha256Checksum` | string | SHA-256 hash |
  | ↳ `parents` | json | Parent folder IDs |
  | ↳ `spaces` | json | Spaces containing file |
  | ↳ `driveId` | string | Shared drive ID |
  | ↳ `capabilities` | json | User capabilities on file |
  | ↳ `version` | string | Version number |
  | ↳ `headRevisionId` | string | Head revision ID |
  | ↳ `hasThumbnail` | boolean | Whether has thumbnail |
  | ↳ `thumbnailVersion` | string | Thumbnail version |
  | ↳ `imageMediaMetadata` | json | Image-specific metadata |
  | ↳ `videoMediaMetadata` | json | Video-specific metadata |
  | ↳ `isAppAuthorized` | boolean | Whether created by requesting app |
  | ↳ `contentRestrictions` | json | Content restrictions |
  | ↳ `linkShareMetadata` | json | Link share metadata |
  | `nextPageToken` | string | Page token for the next page of files; absent from the response when the end of the files list has been reached |
</ReferenceDetails>

### Get Google Drive File [#get-google-drive-file]

Get metadata for a specific file in Google Drive by its ID

<ReferenceDetails>
  #### Input [#input-1]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to retrieve |

  #### Output [#output-1]

  | Parameter | Type | Description |
  | - | - | - |
  | `file` | json | The file metadata |
  | ↳ `id` | string | Google Drive file ID |
  | ↳ `kind` | string | Resource type identifier |
  | ↳ `name` | string | File name |
  | ↳ `mimeType` | string | MIME type |
  | ↳ `description` | string | File description |
  | ↳ `size` | string | File size in bytes |
  | ↳ `starred` | boolean | Whether file is starred |
  | ↳ `trashed` | boolean | Whether file is in trash |
  | ↳ `webViewLink` | string | URL to view in browser |
  | ↳ `webContentLink` | string | Direct download URL |
  | ↳ `iconLink` | string | URL to file icon |
  | ↳ `thumbnailLink` | string | URL to thumbnail |
  | ↳ `parents` | json | Parent folder IDs |
  | ↳ `owners` | json | List of file owners |
  | ↳ `permissions` | json | File permissions |
  | ↳ `createdTime` | string | File creation time |
  | ↳ `modifiedTime` | string | Last modification time |
  | ↳ `lastModifyingUser` | json | User who last modified the file |
  | ↳ `shared` | boolean | Whether file is shared |
  | ↳ `ownedByMe` | boolean | Whether owned by current user |
  | ↳ `capabilities` | json | User capabilities on file |
  | ↳ `md5Checksum` | string | MD5 hash |
  | ↳ `version` | string | Version number |
</ReferenceDetails>

### Get Content from Google Drive [#get-content-from-google-drive]

Get content from a file in Google Drive with complete metadata (exports Google Workspace files automatically)

<ReferenceDetails>
  #### Input [#input-2]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to get content from |
  | `mimeType` | string | No | The MIME type to export Google Workspace files to (optional) |
  | `includeRevisions` | boolean | No | Whether to include revision history in the metadata (default: true, returns first 100 revisions) |

  #### Output [#output-2]

  | Parameter | Type | Description |
  | - | - | - |
  | `content` | string | File content as text (Google Workspace files are exported) |
  | `metadata` | object | Complete file metadata from Google Drive |
  | ↳ `id` | string | Google Drive file ID |
  | ↳ `kind` | string | Resource type identifier |
  | ↳ `name` | string | File name |
  | ↳ `mimeType` | string | MIME type |
  | ↳ `description` | string | File description |
  | ↳ `originalFilename` | string | Original uploaded filename |
  | ↳ `fullFileExtension` | string | Full file extension |
  | ↳ `fileExtension` | string | File extension |
  | ↳ `owners` | json | List of file owners |
  | ↳ `permissions` | json | File permissions |
  | ↳ `permissionIds` | json | Permission IDs |
  | ↳ `shared` | boolean | Whether file is shared |
  | ↳ `ownedByMe` | boolean | Whether owned by current user |
  | ↳ `writersCanShare` | boolean | Whether writers can share |
  | ↳ `viewersCanCopyContent` | boolean | Whether viewers can copy |
  | ↳ `copyRequiresWriterPermission` | boolean | Whether copy requires writer permission |
  | ↳ `sharingUser` | json | User who shared the file |
  | ↳ `starred` | boolean | Whether file is starred |
  | ↳ `trashed` | boolean | Whether file is in trash |
  | ↳ `explicitlyTrashed` | boolean | Whether explicitly trashed |
  | ↳ `appProperties` | json | App-specific properties |
  | ↳ `createdTime` | string | File creation time |
  | ↳ `modifiedTime` | string | Last modification time |
  | ↳ `modifiedByMeTime` | string | When modified by current user |
  | ↳ `viewedByMeTime` | string | When last viewed by current user |
  | ↳ `sharedWithMeTime` | string | When shared with current user |
  | ↳ `lastModifyingUser` | json | User who last modified the file |
  | ↳ `viewedByMe` | boolean | Whether viewed by current user |
  | ↳ `modifiedByMe` | boolean | Whether modified by current user |
  | ↳ `webViewLink` | string | URL to view in browser |
  | ↳ `webContentLink` | string | Direct download URL |
  | ↳ `iconLink` | string | URL to file icon |
  | ↳ `thumbnailLink` | string | URL to thumbnail |
  | ↳ `exportLinks` | json | Export format links |
  | ↳ `size` | string | File size in bytes |
  | ↳ `quotaBytesUsed` | string | Storage quota used |
  | ↳ `md5Checksum` | string | MD5 hash |
  | ↳ `sha1Checksum` | string | SHA-1 hash |
  | ↳ `sha256Checksum` | string | SHA-256 hash |
  | ↳ `parents` | json | Parent folder IDs |
  | ↳ `spaces` | json | Spaces containing file |
  | ↳ `driveId` | string | Shared drive ID |
  | ↳ `capabilities` | json | User capabilities on file |
  | ↳ `version` | string | Version number |
  | ↳ `headRevisionId` | string | Head revision ID |
  | ↳ `hasThumbnail` | boolean | Whether has thumbnail |
  | ↳ `thumbnailVersion` | string | Thumbnail version |
  | ↳ `imageMediaMetadata` | json | Image-specific metadata |
  | ↳ `videoMediaMetadata` | json | Video-specific metadata |
  | ↳ `isAppAuthorized` | boolean | Whether created by requesting app |
  | ↳ `contentRestrictions` | json | Content restrictions |
  | ↳ `linkShareMetadata` | json | Link share metadata |
  | ↳ `revisions` | json | File revision history (first 100 revisions only) |
</ReferenceDetails>

### Create Folder in Google Drive [#create-folder-in-google-drive]

Create a new folder in Google Drive with complete metadata returned

<ReferenceDetails>
  #### Input [#input-3]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileName` | string | Yes | Name of the folder to create |
  | `folderSelector` | string | No | Google Drive parent folder ID to create the folder in (e.g., 1ABCxyz...) |
  | `folderId` | string | No | ID of the parent folder (internal use) |

  #### Output [#output-3]

  | Parameter | Type | Description |
  | - | - | - |
  | `file` | object | Complete created folder metadata from Google Drive |
  | ↳ `id` | string | Google Drive folder ID |
  | ↳ `kind` | string | Resource type identifier |
  | ↳ `name` | string | Folder name |
  | ↳ `mimeType` | string | MIME type (application/vnd.google-apps.folder) |
  | ↳ `description` | string | Folder description |
  | ↳ `owners` | json | List of folder owners |
  | ↳ `permissions` | json | Folder permissions |
  | ↳ `permissionIds` | json | Permission IDs |
  | ↳ `shared` | boolean | Whether folder is shared |
  | ↳ `ownedByMe` | boolean | Whether owned by current user |
  | ↳ `writersCanShare` | boolean | Whether writers can share |
  | ↳ `viewersCanCopyContent` | boolean | Whether viewers can copy |
  | ↳ `copyRequiresWriterPermission` | boolean | Whether copy requires writer permission |
  | ↳ `sharingUser` | json | User who shared the folder |
  | ↳ `starred` | boolean | Whether folder is starred |
  | ↳ `trashed` | boolean | Whether folder is in trash |
  | ↳ `explicitlyTrashed` | boolean | Whether explicitly trashed |
  | ↳ `appProperties` | json | App-specific properties |
  | ↳ `folderColorRgb` | string | Folder color |
  | ↳ `createdTime` | string | Folder creation time |
  | ↳ `modifiedTime` | string | Last modification time |
  | ↳ `modifiedByMeTime` | string | When modified by current user |
  | ↳ `viewedByMeTime` | string | When last viewed by current user |
  | ↳ `sharedWithMeTime` | string | When shared with current user |
  | ↳ `lastModifyingUser` | json | User who last modified the folder |
  | ↳ `viewedByMe` | boolean | Whether viewed by current user |
  | ↳ `modifiedByMe` | boolean | Whether modified by current user |
  | ↳ `webViewLink` | string | URL to view in browser |
  | ↳ `iconLink` | string | URL to folder icon |
  | ↳ `parents` | json | Parent folder IDs |
  | ↳ `spaces` | json | Spaces containing folder |
  | ↳ `driveId` | string | Shared drive ID |
  | ↳ `capabilities` | json | User capabilities on folder |
  | ↳ `version` | string | Version number |
  | ↳ `isAppAuthorized` | boolean | Whether created by requesting app |
  | ↳ `contentRestrictions` | json | Content restrictions |
  | ↳ `linkShareMetadata` | json | Link share metadata |
</ReferenceDetails>

### Upload to Google Drive [#upload-to-google-drive]

Upload a file to Google Drive with complete metadata returned

<ReferenceDetails>
  #### Input [#input-4]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileName` | string | Yes | The name of the file to upload |
  | `file` | file | No | Binary file to upload (UserFile object) |
  | `content` | string | No | Text content to upload (use this OR file, not both) |
  | `mimeType` | string | No | The MIME type of the file to upload (auto-detected from file if not provided) |
  | `folderSelector` | string | No | Google Drive folder ID to upload the file to (e.g., 1ABCxyz...) |
  | `folderId` | string | No | The ID of the folder to upload the file to (internal use) |

  #### Output [#output-4]

  | Parameter | Type | Description |
  | - | - | - |
  | `file` | object | Complete uploaded file metadata from Google Drive |
  | ↳ `id` | string | Google Drive file ID |
  | ↳ `kind` | string | Resource type identifier |
  | ↳ `name` | string | File name |
  | ↳ `mimeType` | string | MIME type |
  | ↳ `description` | string | File description |
  | ↳ `originalFilename` | string | Original uploaded filename |
  | ↳ `fullFileExtension` | string | Full file extension |
  | ↳ `fileExtension` | string | File extension |
  | ↳ `owners` | json | List of file owners |
  | ↳ `permissions` | json | File permissions |
  | ↳ `permissionIds` | json | Permission IDs |
  | ↳ `shared` | boolean | Whether file is shared |
  | ↳ `ownedByMe` | boolean | Whether owned by current user |
  | ↳ `writersCanShare` | boolean | Whether writers can share |
  | ↳ `viewersCanCopyContent` | boolean | Whether viewers can copy |
  | ↳ `copyRequiresWriterPermission` | boolean | Whether copy requires writer permission |
  | ↳ `sharingUser` | json | User who shared the file |
  | ↳ `starred` | boolean | Whether file is starred |
  | ↳ `trashed` | boolean | Whether file is in trash |
  | ↳ `explicitlyTrashed` | boolean | Whether explicitly trashed |
  | ↳ `appProperties` | json | App-specific properties |
  | ↳ `createdTime` | string | File creation time |
  | ↳ `modifiedTime` | string | Last modification time |
  | ↳ `modifiedByMeTime` | string | When modified by current user |
  | ↳ `viewedByMeTime` | string | When last viewed by current user |
  | ↳ `sharedWithMeTime` | string | When shared with current user |
  | ↳ `lastModifyingUser` | json | User who last modified the file |
  | ↳ `viewedByMe` | boolean | Whether viewed by current user |
  | ↳ `modifiedByMe` | boolean | Whether modified by current user |
  | ↳ `webViewLink` | string | URL to view in browser |
  | ↳ `webContentLink` | string | Direct download URL |
  | ↳ `iconLink` | string | URL to file icon |
  | ↳ `thumbnailLink` | string | URL to thumbnail |
  | ↳ `exportLinks` | json | Export format links |
  | ↳ `size` | string | File size in bytes |
  | ↳ `quotaBytesUsed` | string | Storage quota used |
  | ↳ `md5Checksum` | string | MD5 hash |
  | ↳ `sha1Checksum` | string | SHA-1 hash |
  | ↳ `sha256Checksum` | string | SHA-256 hash |
  | ↳ `parents` | json | Parent folder IDs |
  | ↳ `spaces` | json | Spaces containing file |
  | ↳ `driveId` | string | Shared drive ID |
  | ↳ `capabilities` | json | User capabilities on file |
  | ↳ `version` | string | Version number |
  | ↳ `headRevisionId` | string | Head revision ID |
  | ↳ `hasThumbnail` | boolean | Whether has thumbnail |
  | ↳ `thumbnailVersion` | string | Thumbnail version |
  | ↳ `imageMediaMetadata` | json | Image-specific metadata |
  | ↳ `videoMediaMetadata` | json | Video-specific metadata |
  | ↳ `isAppAuthorized` | boolean | Whether created by requesting app |
  | ↳ `contentRestrictions` | json | Content restrictions |
  | ↳ `linkShareMetadata` | json | Link share metadata |
</ReferenceDetails>

### Download File from Google Drive [#download-file-from-google-drive]

Download a file from Google Drive with complete metadata (exports Google Workspace files automatically)

<ReferenceDetails>
  #### Input [#input-5]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to download |
  | `mimeType` | string | No | The MIME type to export Google Workspace files to (optional) |
  | `fileName` | string | No | Optional filename override |
  | `includeRevisions` | boolean | No | Whether to include revision history in the metadata (default: true, returns first 100 revisions) |

  #### Output [#output-5]

  | Parameter | Type | Description |
  | - | - | - |
  | `file` | file | Downloaded file stored in execution files |
  | `metadata` | object | Complete file metadata from Google Drive |
  | ↳ `id` | string | Google Drive file ID |
  | ↳ `kind` | string | Resource type identifier |
  | ↳ `name` | string | File name |
  | ↳ `mimeType` | string | MIME type |
  | ↳ `description` | string | File description |
  | ↳ `originalFilename` | string | Original uploaded filename |
  | ↳ `fullFileExtension` | string | Full file extension |
  | ↳ `fileExtension` | string | File extension |
  | ↳ `owners` | json | List of file owners |
  | ↳ `permissions` | json | File permissions |
  | ↳ `permissionIds` | json | Permission IDs |
  | ↳ `shared` | boolean | Whether file is shared |
  | ↳ `ownedByMe` | boolean | Whether owned by current user |
  | ↳ `writersCanShare` | boolean | Whether writers can share |
  | ↳ `viewersCanCopyContent` | boolean | Whether viewers can copy |
  | ↳ `copyRequiresWriterPermission` | boolean | Whether copy requires writer permission |
  | ↳ `sharingUser` | json | User who shared the file |
  | ↳ `starred` | boolean | Whether file is starred |
  | ↳ `trashed` | boolean | Whether file is in trash |
  | ↳ `explicitlyTrashed` | boolean | Whether explicitly trashed |
  | ↳ `appProperties` | json | App-specific properties |
  | ↳ `createdTime` | string | File creation time |
  | ↳ `modifiedTime` | string | Last modification time |
  | ↳ `modifiedByMeTime` | string | When modified by current user |
  | ↳ `viewedByMeTime` | string | When last viewed by current user |
  | ↳ `sharedWithMeTime` | string | When shared with current user |
  | ↳ `lastModifyingUser` | json | User who last modified the file |
  | ↳ `viewedByMe` | boolean | Whether viewed by current user |
  | ↳ `modifiedByMe` | boolean | Whether modified by current user |
  | ↳ `webViewLink` | string | URL to view in browser |
  | ↳ `webContentLink` | string | Direct download URL |
  | ↳ `iconLink` | string | URL to file icon |
  | ↳ `thumbnailLink` | string | URL to thumbnail |
  | ↳ `exportLinks` | json | Export format links |
  | ↳ `size` | string | File size in bytes |
  | ↳ `quotaBytesUsed` | string | Storage quota used |
  | ↳ `md5Checksum` | string | MD5 hash |
  | ↳ `sha1Checksum` | string | SHA-1 hash |
  | ↳ `sha256Checksum` | string | SHA-256 hash |
  | ↳ `parents` | json | Parent folder IDs |
  | ↳ `spaces` | json | Spaces containing file |
  | ↳ `driveId` | string | Shared drive ID |
  | ↳ `capabilities` | json | User capabilities on file |
  | ↳ `version` | string | Version number |
  | ↳ `headRevisionId` | string | Head revision ID |
  | ↳ `hasThumbnail` | boolean | Whether has thumbnail |
  | ↳ `thumbnailVersion` | string | Thumbnail version |
  | ↳ `imageMediaMetadata` | json | Image-specific metadata |
  | ↳ `videoMediaMetadata` | json | Video-specific metadata |
  | ↳ `isAppAuthorized` | boolean | Whether created by requesting app |
  | ↳ `contentRestrictions` | json | Content restrictions |
  | ↳ `linkShareMetadata` | json | Link share metadata |
  | ↳ `revisions` | json | File revision history (first 100 revisions only) |
</ReferenceDetails>

### Copy Google Drive File [#copy-google-drive-file]

Create a copy of a file in Google Drive

<ReferenceDetails>
  #### Input [#input-6]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to copy |
  | `newName` | string | No | Name for the copied file (defaults to "Copy of \[original name]") |
  | `destinationFolderId` | string | No | ID of the folder to place the copy in (defaults to same location as original) |

  #### Output [#output-6]

  | Parameter | Type | Description |
  | - | - | - |
  | `file` | json | The copied file metadata |
  | ↳ `id` | string | Google Drive file ID of the copy |
  | ↳ `kind` | string | Resource type identifier |
  | ↳ `name` | string | File name |
  | ↳ `mimeType` | string | MIME type |
  | ↳ `webViewLink` | string | URL to view in browser |
  | ↳ `parents` | json | Parent folder IDs |
  | ↳ `createdTime` | string | File creation time |
  | ↳ `modifiedTime` | string | Last modification time |
  | ↳ `owners` | json | List of file owners |
  | ↳ `size` | string | File size in bytes |
</ReferenceDetails>

### Move Google Drive File [#move-google-drive-file]

Move a file or folder to a different folder in Google Drive

<ReferenceDetails>
  #### Input [#input-7]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file or folder to move |
  | `destinationFolderId` | string | Yes | The ID of the destination folder |
  | `removeFromCurrent` | boolean | No | Whether to remove the current parent when adding the destination (default: true). Google Drive supports one parent folder, so false can be rejected when the file already has a different parent. |

  #### Output [#output-7]

  | Parameter | Type | Description |
  | - | - | - |
  | `file` | json | The moved file metadata |
  | ↳ `id` | string | Google Drive file ID |
  | ↳ `kind` | string | Resource type identifier |
  | ↳ `name` | string | File name |
  | ↳ `mimeType` | string | MIME type |
  | ↳ `webViewLink` | string | URL to view in browser |
  | ↳ `parents` | json | Parent folder IDs |
  | ↳ `createdTime` | string | File creation time |
  | ↳ `modifiedTime` | string | Last modification time |
  | ↳ `owners` | json | List of file owners |
  | ↳ `size` | string | File size in bytes |
</ReferenceDetails>

### Search Google Drive Files [#search-google-drive-files]

Search for files in Google Drive using advanced query syntax (e.g., fullText contains, mimeType, modifiedTime, etc.)

<ReferenceDetails>
  #### Input [#input-8]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `query` | string | Yes | Google Drive query string using advanced search syntax (e.g., "fullText contains 'budget'", "mimeType = 'application/pdf'", "modifiedTime > '2024-01-01'") |
  | `pageSize` | number | No | Maximum number of files to return (default: 100) |
  | `pageToken` | string | No | Token for fetching the next page of results |

  #### Output [#output-8]

  | Parameter | Type | Description |
  | - | - | - |
  | `files` | array | Array of file metadata objects matching the search query |
  | ↳ `id` | string | Google Drive file ID |
  | ↳ `kind` | string | Resource type identifier |
  | ↳ `name` | string | File name |
  | ↳ `mimeType` | string | MIME type |
  | ↳ `description` | string | File description |
  | ↳ `originalFilename` | string | Original uploaded filename |
  | ↳ `fullFileExtension` | string | Full file extension |
  | ↳ `fileExtension` | string | File extension |
  | ↳ `owners` | json | List of file owners |
  | ↳ `permissions` | json | File permissions |
  | ↳ `shared` | boolean | Whether file is shared |
  | ↳ `ownedByMe` | boolean | Whether owned by current user |
  | ↳ `starred` | boolean | Whether file is starred |
  | ↳ `trashed` | boolean | Whether file is in trash |
  | ↳ `createdTime` | string | File creation time |
  | ↳ `modifiedTime` | string | Last modification time |
  | ↳ `lastModifyingUser` | json | User who last modified the file |
  | ↳ `webViewLink` | string | URL to view in browser |
  | ↳ `webContentLink` | string | Direct download URL |
  | ↳ `iconLink` | string | URL to file icon |
  | ↳ `thumbnailLink` | string | URL to thumbnail |
  | ↳ `size` | string | File size in bytes |
  | ↳ `parents` | json | Parent folder IDs |
  | ↳ `driveId` | string | Shared drive ID |
  | ↳ `capabilities` | json | User capabilities on file |
  | ↳ `version` | string | Version number |
  | `nextPageToken` | string | Page token for the next page of files; absent from the response when the end of the files list has been reached |
</ReferenceDetails>

### Update Google Drive File [#update-google-drive-file]

Update file metadata in Google Drive (rename, move, star, add description)

<ReferenceDetails>
  #### Input [#input-9]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to update |
  | `name` | string | No | New name for the file |
  | `description` | string | No | New description for the file |
  | `addParents` | string | No | Comma-separated list of parent folder IDs to add (moves file to these folders) |
  | `removeParents` | string | No | Comma-separated list of parent folder IDs to remove |
  | `starred` | boolean | No | Whether to star or unstar the file |

  #### Output [#output-9]

  | Parameter | Type | Description |
  | - | - | - |
  | `file` | json | The updated file metadata |
  | ↳ `id` | string | Google Drive file ID |
  | ↳ `kind` | string | Resource type identifier |
  | ↳ `name` | string | File name |
  | ↳ `mimeType` | string | MIME type |
  | ↳ `description` | string | File description |
  | ↳ `starred` | boolean | Whether file is starred |
  | ↳ `webViewLink` | string | URL to view in browser |
  | ↳ `parents` | json | Parent folder IDs |
  | ↳ `modifiedTime` | string | Last modification time |
</ReferenceDetails>

### Trash Google Drive File [#trash-google-drive-file]

Move a file to the trash in Google Drive (can be restored later)

<ReferenceDetails>
  #### Input [#input-10]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to move to trash |

  #### Output [#output-10]

  | Parameter | Type | Description |
  | - | - | - |
  | `file` | json | The trashed file metadata |
  | ↳ `id` | string | Google Drive file ID |
  | ↳ `kind` | string | Resource type identifier |
  | ↳ `name` | string | File name |
  | ↳ `mimeType` | string | MIME type |
  | ↳ `trashed` | boolean | Whether file is in trash (should be true) |
  | ↳ `trashedTime` | string | When file was trashed |
  | ↳ `webViewLink` | string | URL to view in browser |
</ReferenceDetails>

### Restore Google Drive File [#restore-google-drive-file]

Restore a file from the trash in Google Drive

<ReferenceDetails>
  #### Input [#input-11]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to restore from trash |

  #### Output [#output-11]

  | Parameter | Type | Description |
  | - | - | - |
  | `file` | json | The restored file metadata |
  | ↳ `id` | string | Google Drive file ID |
  | ↳ `kind` | string | Resource type identifier |
  | ↳ `name` | string | File name |
  | ↳ `mimeType` | string | MIME type |
  | ↳ `trashed` | boolean | Whether file is in trash (should be false) |
  | ↳ `webViewLink` | string | URL to view in browser |
  | ↳ `parents` | json | Parent folder IDs |
</ReferenceDetails>

### Delete Google Drive File [#delete-google-drive-file]

Permanently delete a file from Google Drive (bypasses trash)

<ReferenceDetails>
  #### Input [#input-12]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to permanently delete |

  #### Output [#output-12]

  | Parameter | Type | Description |
  | - | - | - |
  | `deleted` | boolean | Whether the file was successfully deleted |
  | `fileId` | string | The ID of the deleted file |
</ReferenceDetails>

### Share Google Drive File [#share-google-drive-file]

Share a file with a user, group, domain, or make it public

<ReferenceDetails>
  #### Input [#input-13]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to share |
  | `type` | string | Yes | Type of grantee: user, group, domain, or anyone |
  | `role` | string | Yes | Permission role: owner (transfer ownership), organizer (shared drive only), fileOrganizer (shared drive only), writer (edit), commenter (view and comment), reader (view only) |
  | `email` | string | No | Email address of the user or group (required for type=user or type=group) |
  | `domain` | string | No | Domain to share with (required for type=domain) |
  | `transferOwnership` | boolean | No | Required when role is owner. Transfers ownership to the specified user. |
  | `moveToNewOwnersRoot` | boolean | No | When transferring ownership, move the file to the new owner's My Drive root folder. |
  | `sendNotification` | boolean | No | Whether to send an email notification (default: true) |
  | `emailMessage` | string | No | Custom message to include in the notification email |

  #### Output [#output-13]

  | Parameter | Type | Description |
  | - | - | - |
  | `permission` | json | The created permission details |
  | ↳ `id` | string | Permission ID |
  | ↳ `type` | string | Grantee type (user, group, domain, anyone) |
  | ↳ `role` | string | Permission role |
  | ↳ `emailAddress` | string | Email of the grantee |
  | ↳ `displayName` | string | Display name of the grantee |
  | ↳ `domain` | string | Domain of the grantee |
  | ↳ `expirationTime` | string | Expiration time |
  | ↳ `deleted` | boolean | Whether grantee is deleted |
</ReferenceDetails>

### Unshare Google Drive File [#unshare-google-drive-file]

Remove a permission from a file (revoke access)

<ReferenceDetails>
  #### Input [#input-14]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to modify permissions on |
  | `permissionId` | string | Yes | The ID of the permission to remove (use list\_permissions to find this) |

  #### Output [#output-14]

  | Parameter | Type | Description |
  | - | - | - |
  | `removed` | boolean | Whether the permission was successfully removed |
  | `fileId` | string | The ID of the file |
  | `permissionId` | string | The ID of the removed permission |
</ReferenceDetails>

### List Google Drive Permissions [#list-google-drive-permissions]

List all permissions (who has access) for a file in Google Drive

<ReferenceDetails>
  #### Input [#input-15]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to list permissions for |
  | `pageToken` | string | No | The page token to use for pagination |

  #### Output [#output-15]

  | Parameter | Type | Description |
  | - | - | - |
  | `permissions` | array | List of permissions on the file |
  | ↳ `id` | string | Permission ID (use to remove permission) |
  | ↳ `type` | string | Grantee type (user, group, domain, anyone) |
  | ↳ `role` | string | Permission role (owner, organizer, fileOrganizer, writer, commenter, reader) |
  | ↳ `emailAddress` | string | Email of the grantee |
  | ↳ `displayName` | string | Display name of the grantee |
  | ↳ `photoLink` | string | Photo URL of the grantee |
  | ↳ `domain` | string | Domain of the grantee |
  | ↳ `expirationTime` | string | When permission expires |
  | ↳ `deleted` | boolean | Whether grantee account is deleted |
  | ↳ `allowFileDiscovery` | boolean | Whether file is discoverable by grantee |
  | ↳ `pendingOwner` | boolean | Whether ownership transfer is pending |
  | ↳ `permissionDetails` | json | Details about inherited permissions |
  | `nextPageToken` | string | Page token for the next page of permissions; absent from the response when the end of the permissions list has been reached |
</ReferenceDetails>

### Export Google Drive File [#export-google-drive-file]

Export a Google Workspace file (Docs, Sheets, Slides, Drawings) to a chosen format such as PDF, DOCX, XLSX, or CSV

<ReferenceDetails>
  #### Input [#input-16]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the Google Workspace file to export |
  | `mimeType` | string | Yes | The target MIME type to export to (e.g. application/pdf, text/csv) |
  | `fileName` | string | No | Optional filename override for the exported file |

  #### Output [#output-16]

  | Parameter | Type | Description |
  | - | - | - |
  | `file` | file | Exported file stored in execution files |
  | `exportedMimeType` | string | The MIME type the file was exported to |
</ReferenceDetails>

### List Google Drive Revisions [#list-google-drive-revisions]

List the revision history of a file in Google Drive

<ReferenceDetails>
  #### Input [#input-17]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to list revisions for |
  | `pageSize` | number | No | Maximum number of revisions to return (1-1000, default 200) |
  | `pageToken` | string | No | The page token to use for pagination |

  #### Output [#output-17]

  | Parameter | Type | Description |
  | - | - | - |
  | `revisions` | array | List of revisions for the file (most recent last) |
  | ↳ `id` | string | Revision ID |
  | ↳ `mimeType` | string | MIME type of the revision |
  | ↳ `modifiedTime` | string | When this revision was created |
  | ↳ `keepForever` | boolean | Whether this revision is preserved forever |
  | ↳ `published` | boolean | Whether this revision is published |
  | ↳ `publishedLink` | string | Public link to the published revision |
  | ↳ `lastModifyingUser` | json | User who created this revision |
  | ↳ `originalFilename` | string | Original filename for binary revisions |
  | ↳ `md5Checksum` | string | MD5 checksum for binary revisions |
  | ↳ `size` | string | Size of the revision in bytes |
  | ↳ `exportLinks` | json | Export format links for the revision |
  | `nextPageToken` | string | Page token for the next page of revisions; absent from the response when the end of the revisions list has been reached |
</ReferenceDetails>

### Get Google Drive Revision [#get-google-drive-revision]

Get metadata for a specific revision of a file in Google Drive

<ReferenceDetails>
  #### Input [#input-18]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file the revision belongs to |
  | `revisionId` | string | Yes | The ID of the revision to retrieve |

  #### Output [#output-18]

  | Parameter | Type | Description |
  | - | - | - |
  | `revision` | json | The revision metadata |
  | ↳ `id` | string | Revision ID |
  | ↳ `mimeType` | string | MIME type of the revision |
  | ↳ `modifiedTime` | string | When this revision was created |
  | ↳ `keepForever` | boolean | Whether this revision is preserved forever |
  | ↳ `published` | boolean | Whether this revision is published |
  | ↳ `publishedLink` | string | Public link to the published revision |
  | ↳ `lastModifyingUser` | json | User who created this revision |
  | ↳ `originalFilename` | string | Original filename for binary revisions |
  | ↳ `md5Checksum` | string | MD5 checksum for binary revisions |
  | ↳ `size` | string | Size of the revision in bytes |
  | ↳ `exportLinks` | json | Export format links for the revision |
</ReferenceDetails>

### List Google Drive Comments [#list-google-drive-comments]

List comments on a file in Google Drive

<ReferenceDetails>
  #### Input [#input-19]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to list comments for |
  | `includeDeleted` | boolean | No | Whether to include deleted comments (their content is stripped) |
  | `pageSize` | number | No | Maximum number of comments to return (1-100, default 20) |
  | `startModifiedTime` | string | No | Only return comments modified after this RFC 3339 timestamp |
  | `pageToken` | string | No | The page token to use for pagination |

  #### Output [#output-19]

  | Parameter | Type | Description |
  | - | - | - |
  | `comments` | array | List of comments on the file |
  | ↳ `id` | string | Comment ID |
  | ↳ `content` | string | Plain text content of the comment |
  | ↳ `htmlContent` | string | HTML-formatted content of the comment |
  | ↳ `author` | json | User who authored the comment |
  | ↳ `createdTime` | string | When the comment was created |
  | ↳ `modifiedTime` | string | When the comment was last modified |
  | ↳ `resolved` | boolean | Whether the comment has been resolved |
  | ↳ `deleted` | boolean | Whether the comment has been deleted |
  | ↳ `anchor` | string | Region of the document the comment refers to |
  | ↳ `quotedFileContent` | json | The file content the comment quotes |
  | ↳ `replies` | json | Threaded replies to the comment |
  | `nextPageToken` | string | Page token for the next page of comments; absent from the response when the end of the comments list has been reached |
</ReferenceDetails>

### Create Google Drive Comment [#create-google-drive-comment]

Add a comment to a file in Google Drive

<ReferenceDetails>
  #### Input [#input-20]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file to comment on |
  | `content` | string | Yes | The plain text content of the comment |
  | `anchor` | string | No | A region of the document the comment refers to (JSON anchor string) |

  #### Output [#output-20]

  | Parameter | Type | Description |
  | - | - | - |
  | `comment` | json | The created comment |
  | ↳ `id` | string | Comment ID |
  | ↳ `content` | string | Plain text content of the comment |
  | ↳ `htmlContent` | string | HTML-formatted content of the comment |
  | ↳ `author` | json | User who authored the comment |
  | ↳ `createdTime` | string | When the comment was created |
  | ↳ `modifiedTime` | string | When the comment was last modified |
  | ↳ `resolved` | boolean | Whether the comment has been resolved |
  | ↳ `deleted` | boolean | Whether the comment has been deleted |
  | ↳ `anchor` | string | Region of the document the comment refers to |
  | ↳ `quotedFileContent` | json | The file content the comment quotes |
  | ↳ `replies` | json | Threaded replies to the comment |
</ReferenceDetails>

### Delete Google Drive Comment [#delete-google-drive-comment]

Delete a comment from a file in Google Drive

<ReferenceDetails>
  #### Input [#input-21]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `fileId` | string | Yes | The ID of the file the comment belongs to |
  | `commentId` | string | Yes | The ID of the comment to delete |

  #### Output [#output-21]

  | Parameter | Type | Description |
  | - | - | - |
  | `deleted` | boolean | Whether the comment was successfully deleted |
  | `fileId` | string | The ID of the file |
  | `commentId` | string | The ID of the deleted comment |
</ReferenceDetails>

### Get Google Drive Info [#get-google-drive-info]

Get information about the user and their Google Drive (storage quota, capabilities)

<ReferenceDetails>
  #### Input [#input-22]

  | Parameter | Type | Required | Description |
  | - | - | - | - |

  #### Output [#output-22]

  | Parameter | Type | Description |
  | - | - | - |
  | `user` | json | Information about the authenticated user |
  | ↳ `displayName` | string | User display name |
  | ↳ `emailAddress` | string | User email address |
  | ↳ `photoLink` | string | URL to user profile photo |
  | ↳ `permissionId` | string | User permission ID |
  | ↳ `me` | boolean | Whether this is the authenticated user |
  | `storageQuota` | json | Storage quota information in bytes |
  | ↳ `limit` | string | Total storage limit in bytes (null for unlimited) |
  | ↳ `usage` | string | Total storage used in bytes |
  | ↳ `usageInDrive` | string | Storage used by Drive files in bytes |
  | ↳ `usageInDriveTrash` | string | Storage used by trashed files in bytes |
  | `canCreateDrives` | boolean | Whether user can create shared drives |
  | `importFormats` | json | Map of MIME types that can be imported and their target formats |
  | `exportFormats` | json | Map of Google Workspace MIME types and their exportable formats |
  | `maxUploadSize` | string | Maximum upload size in bytes |
</ReferenceDetails>

## Triggers [#triggers]

A trigger starts a workflow when a supported event occurs in this service.

These triggers poll for new data on a schedule.

### Google Drive File Trigger [#google-drive-file-trigger]

Triggers when files are created, modified, or deleted in Google Drive

#### Configuration [#configuration]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `triggerCredentials` | string | Yes | Connect your Google account to access Google Drive. |
| `folderId` | file-selector | No | Optional: The folder to monitor. Leave empty to monitor all files in Drive. |
| `manualFolderId` | string | No | Optional: The folder ID from the Google Drive URL to monitor. Leave empty to monitor all files. |
| `mimeTypeFilter` | string | No | Optional: Only trigger for specific file types. |
| `eventTypeFilter` | string | No | Only trigger for specific change types. Defaults to all changes. |
| `includeSharedDrives` | boolean | No | Include files from shared (team) drives. |

#### Output [#output-23]

| Parameter | Type | Description |
| - | - | - |
| `file` | object | |
| ↳ `id` | string | Google Drive file ID |
| ↳ `name` | string | File name |
| ↳ `mimeType` | string | File MIME type |
| ↳ `modifiedTime` | string | Last modified time (ISO) |
| ↳ `createdTime` | string | File creation time (ISO) |
| ↳ `size` | string | File size in bytes |
| ↳ `webViewLink` | string | URL to view file in browser |
| ↳ `parents` | json | Parent folder IDs |
| ↳ `lastModifyingUser` | json | User who last modified the file |
| ↳ `shared` | boolean | Whether file is shared |
| ↳ `starred` | boolean | Whether file is starred |
| `eventType` | string | Change type: "created", "modified", or "deleted" |
| `timestamp` | string | Event timestamp in ISO format |
