# Google Drive

<!-- Generated by tools/catalogue/generate.py from flow.service.workflow 5.0.0-beta.39. Don't edit by hand. -->

# Google Drive

The Google Drive category has 7 tasks. Each entry shows the task's latest revision, the one the palette adds. See [Reading an entry](https://www.useboomerang.io/docs/flow/main/catalogue/overview#reading-an-entry).

## Copy File

Creates a copy of a file. Folders cannot be copied.

The file will be owned by the Service Account used. We recommend providing a shared parent folder or adding new permissions after the copy.

- **Slug:** `copy-file`
- **Type:** `template`
- **Revision:** 3
- **Image:** Default task image.

**Parameters**

| Label | Name | Type | Required | Default | Helper text |
| --- | --- | --- | --- | --- | --- |
| Service Account Key | `serviceAccountKey` | Secured | No | `$(workspace.params.google-service-account-key)` | The service account's whole JSON key file, pasted as-is. Replaces Client Email and Private Key |
| Private Key | `privateKey` | Secured | No |  | The service account's private key. Not needed when Service Account Key is set |
| Client Email | `clientEmail` | Text | No |  | The service account's client email. Not needed when Service Account Key is set |
| File ID | `fileId` | Text | Yes |  |  |
| Parent Folders | `parents` | Text Area | No |  | New line delimited list of folder IDs |
| New Name | `fileName` | Text | No |  | The name to set on the copied file |

**Results**

| Name | Description |
| --- | --- |
| `id` | The ID of the file. |
| `name` | The name of the file. |
| `parents` | The IDs of the parent folders which contain the file. |
| `createdTime` | The time at which the file was created |
| `modifiedTime` | The last time the file was modified by anyone |
| `owners` | The owner of this file. |
| `permissions` | The full list of permissions for the file. This is only available if the requesting user can share the file. Not populated for items in shared drives. |
| `shared` | Whether the file is shared |
| `webViewLink` | A link for opening the file in a relevant Google editor or viewer in a browser. |

## Delete File

Deletes a file.

- **Slug:** `delete-file`
- **Type:** `template`
- **Revision:** 3
- **Image:** Default task image.

**Parameters**

| Label | Name | Type | Required | Default | Helper text |
| --- | --- | --- | --- | --- | --- |
| Service Account Key | `serviceAccountKey` | Secured | No | `$(workspace.params.google-service-account-key)` | The service account's whole JSON key file, pasted as-is. Replaces Client Email and Private Key |
| Private Key | `privateKey` | Secured | No |  | The service account's private key. Not needed when Service Account Key is set |
| Client Email | `clientEmail` | Text | No |  | The service account's client email. Not needed when Service Account Key is set |
| File ID | `fileId` | Text | Yes |  |  |

No results.

## Download Google Drive File

Downloads a Google Drive file to the workspace with a service account. A Google Docs, Sheets, Slides or Drawings file is exported (up to 10 MB), by default as .docx, .xlsx, .pptx or .png.

- **Slug:** `download-google-drive-file`
- **Type:** `template`
- **Revision:** 1
- **Image:** Default task image.

**Parameters**

| Label | Name | Type | Required | Default | Helper text |
| --- | --- | --- | --- | --- | --- |
| Service Account Key | `serviceAccountKey` | Secured | Yes | `$(workspace.params.google-service-account-key)` | Defaults to the key the workspace's Google integration shares; or paste a service account's whole JSON key file as-is |
| File ID | `fileId` | Text | Yes |  |  |
| Destination | `destinationPath` | Text | Yes |  | A workspace file or directory, absolute or relative to /workspace. A directory (or a path ending in /) keeps the file's name |
| Export Format | `exportMimeType` | Text | No |  | For a Google Docs file only: the MIME type to export as, e.g. application/pdf. Blank is the Office format |

**Results**

| Name | Description |
| --- | --- |
| `path` | The absolute path of the downloaded file |
| `size` | The file's size in bytes |
| `mimeType` | The downloaded file's MIME type |

## List File Permissions

List a file's permissions.

- **Slug:** `list-file-permissions`
- **Type:** `template`
- **Revision:** 3
- **Image:** Default task image.

**Parameters**

| Label | Name | Type | Required | Default | Helper text |
| --- | --- | --- | --- | --- | --- |
| Service Account Key | `serviceAccountKey` | Secured | No | `$(workspace.params.google-service-account-key)` | The service account's whole JSON key file, pasted as-is. Replaces Client Email and Private Key |
| Private Key | `privateKey` | Secured | No |  | The service account's private key. Not needed when Service Account Key is set |
| Client Email | `clientEmail` | Text | No |  | The service account's client email. Not needed when Service Account Key is set |
| File ID | `fileId` | Text | Yes |  |  |

**Results**

| Name | Description |
| --- | --- |
| `permissions` | The resulting array of permissions associated with the file |

## List Files

Lists or searches files.

This method returns all files by default, including deleted files. Use the 'trashed=false' query parameter to filter trashed files from the results.

- **Slug:** `list-files`
- **Type:** `template`
- **Revision:** 3
- **Image:** Default task image.

**Parameters**

| Label | Name | Type | Required | Default | Helper text |
| --- | --- | --- | --- | --- | --- |
| Service Account Key | `serviceAccountKey` | Secured | No | `$(workspace.params.google-service-account-key)` | The service account's whole JSON key file, pasted as-is. Replaces Client Email and Private Key |
| Private Key | `privateKey` | Secured | No |  | The service account's private key. Not needed when Service Account Key is set |
| Client Email | `clientEmail` | Text | No |  | The service account's client email. Not needed when Service Account Key is set |
| Query | `query` | Text | No |  | A query for filtering the file results |
| Corpora | `corpora` | Text | No |  | Groupings of files to which the query applies. |
| Drive ID | `driveId` | Text | No |  | ID of the shared drive to search. |

**Results**

| Name | Description |
| --- | --- |
| `results` | An array of file objects based on the listing query. |

## Share Google Drive File

Shares a Google Drive file or folder with a user, a group, a domain, or anyone with the link, with a service account.

- **Slug:** `share-google-drive-file`
- **Type:** `template`
- **Revision:** 1
- **Image:** Default task image.

**Parameters**

| Label | Name | Type | Required | Default | Helper text |
| --- | --- | --- | --- | --- | --- |
| Service Account Key | `serviceAccountKey` | Secured | Yes | `$(workspace.params.google-service-account-key)` | Defaults to the key the workspace's Google integration shares; or paste a service account's whole JSON key file as-is |
| File ID | `fileId` | Text | Yes |  |  |
| Share With | `type` | Select | Yes |  | anyone means anyone with the link |
| Role | `role` | Select | Yes |  |  |
| Email Address | `emailAddress` | Text | No |  | The user's or group's email; required to share with a user or group |
| Domain | `domain` | Text | No |  | The domain, e.g. acme.com; required to share with a domain |
| Send Notification Email | `sendNotificationEmail` | Boolean | No | `true` | Email a user or group that the file is shared with them |
| Email Message | `emailMessage` | Text Area | No |  | A message for the notification email |

**Results**

| Name | Description |
| --- | --- |
| `permissionId` | The new permission's ID |
| `webViewLink` | The file's link in Drive |

## Upload Google Drive File

Uploads a workspace file to Google Drive with a service account. A service account has no Drive storage of its own, so upload into a shared drive folder it is a member of.

- **Slug:** `upload-google-drive-file`
- **Type:** `template`
- **Revision:** 1
- **Image:** Default task image.

**Parameters**

| Label | Name | Type | Required | Default | Helper text |
| --- | --- | --- | --- | --- | --- |
| Service Account Key | `serviceAccountKey` | Secured | Yes | `$(workspace.params.google-service-account-key)` | Defaults to the key the workspace's Google integration shares; or paste a service account's whole JSON key file as-is |
| File | `filePath` | Text | Yes |  | The workspace file to upload, absolute or relative to /workspace |
| Folder ID | `folderId` | Text | No |  | The ID of the Drive folder to upload into, in a shared drive |
| File Name | `fileName` | Text | No |  | The name in Drive. Blank keeps the file's own name |
| MIME Type | `mimeType` | Text | No |  | The file's content type, e.g. text/csv. Blank lets Drive detect it |

**Results**

| Name | Description |
| --- | --- |
| `fileId` | The new file's ID |
| `fileName` | The file's name in Drive |
| `webViewLink` | The file's link in Drive |
