ByteChef LogoByteChef

Google Drive

Google Drive is a cloud storage service by Google that enables users to store, sync, share files, and collaborate online.

Categories: File Storage

Type: googleDrive/v1


Connections

Version: 1

OAuth2 Authorization Code

Properties

NameLabelTypeDescriptionRequired
clientIdClient IdSTRINGtrue
clientSecretClient SecretSTRINGtrue

Connection Setup

Create OAuth 2.0 Application

Creation of OAuth 2.0 application is documented here.

Enable Google Drive API

  1. In the Google Cloud Console, select your project.
  2. Go to the APIs & Services.
  3. Click on ENABLE APIS AND SERVICES.
  4. Search for "google drive api" in the search bar.
  5. Click on Google Drive API.
  6. Click Enable.

Actions

Copy File

Name: copyFile

Copy a selected file to a different location within Google Drive.

Properties

NameLabelTypeDescriptionRequired
fileIdFile IDSTRINGThe ID of the file to be copied.true
fileNameNew File NameSTRINGThe name of the new file created as a result of the copy operation.true
folderIdDestination Folder IDSTRINGThe ID of the folder where the copied file will be stored.true

Example JSON Structure

{
  "label" : "Copy File",
  "name" : "copyFile",
  "parameters" : {
    "fileId" : "",
    "fileName" : "",
    "folderId" : ""
  },
  "type" : "googleDrive/v1/copyFile"
}

Output

Type: OBJECT

Properties

NameTypeDescription
idSTRINGThe ID of the file.
kindSTRINGIdentifies what kind of resource this is.
mimeTypeSTRINGThe MIME type of the file.
nameSTRINGThe name of the file.

Output Example

{
  "id" : "",
  "kind" : "",
  "mimeType" : "",
  "name" : ""
}

Find File ID

To find the File ID, click here.

Find Folder ID

To find the Folder ID, click here.

Create New Folder

Name: createNewFolder

Creates a new empty folder in Google Drive.

Properties

NameLabelTypeDescriptionRequired
folderNameFolder NameSTRINGThe name of the new folder.true
folderIdParent Folder IDSTRINGID of the folder where the new folder will be created; if no folder is selected, the folder will be created in the root folder.false

Example JSON Structure

{
  "label" : "Create New Folder",
  "name" : "createNewFolder",
  "parameters" : {
    "folderName" : "",
    "folderId" : ""
  },
  "type" : "googleDrive/v1/createNewFolder"
}

Output

Sample Output:

{id=1hPJ7kjhStTX90amAWSJ-V0K1-nhDlsIr, mimeType=plain/text, name=new-file.txt}

Type: OBJECT

Properties

NameTypeDescription
idSTRINGThe ID of the file.
kindSTRINGIdentifies what kind of resource this is.
mimeTypeSTRINGThe MIME type of the file.
nameSTRINGThe name of the file.

Output Example

{
  "id" : "",
  "kind" : "",
  "mimeType" : "",
  "name" : ""
}

Find Folder ID

To find the Folder ID, click here.

Create New Text File

Name: createNewTextFile

Creates a new text file in Google Drive.

Properties

NameLabelTypeDescriptionRequired
fileNameFile NameSTRINGThe name of the new text file.true
textTextSTRINGThe text content to add to file.true
mimeTypeFile TypeSTRING
Options plain/text, text/csv, text/xml
Select file type.true
folderIdParent Folder IDSTRINGID of the folder where the file should be created; if no folder is selected, the file will be created in the root folder.false

Example JSON Structure

{
  "label" : "Create New Text File",
  "name" : "createNewTextFile",
  "parameters" : {
    "fileName" : "",
    "text" : "",
    "mimeType" : "",
    "folderId" : ""
  },
  "type" : "googleDrive/v1/createNewTextFile"
}

Output

Sample Output:

{id=1hPJ7kjhStTX90amAWSJ-V0K1-nhDlsIr, mimeType=plain/text, name=new-file.txt}

Type: OBJECT

Properties

NameTypeDescription
idSTRINGThe ID of the file.
kindSTRINGIdentifies what kind of resource this is.
mimeTypeSTRINGThe MIME type of the file.
nameSTRINGThe name of the file.

Output Example

{
  "id" : "",
  "kind" : "",
  "mimeType" : "",
  "name" : ""
}

Find Folder ID

To find the Folder ID, click here.

Delete File

Name: deleteFile

Delete a selected file from Google Drive.

Properties

NameLabelTypeDescriptionRequired
fileIdFile IDSTRINGThe ID of a file to delete.true

Example JSON Structure

{
  "label" : "Delete File",
  "name" : "deleteFile",
  "parameters" : {
    "fileId" : ""
  },
  "type" : "googleDrive/v1/deleteFile"
}

Output

This action does not produce any output.

Find File ID

To find the File ID, click here.

Download File

Name: downloadFile

Download selected file from Google Drive.

Properties

NameLabelTypeDescriptionRequired
fileIdFile IDSTRINGID of the file to download.true

Example JSON Structure

{
  "label" : "Download File",
  "name" : "downloadFile",
  "parameters" : {
    "fileId" : ""
  },
  "type" : "googleDrive/v1/downloadFile"
}

Output

Type: FILE_ENTRY

Properties

NameTypeDescription
extensionSTRING
mimeTypeSTRING
nameSTRING
urlSTRING

Output Example

{
  "extension" : "",
  "mimeType" : "",
  "name" : "",
  "url" : ""
}

Find File ID

To find the File ID, click here.

Get File

Name: getFile

Retrieve a specified file from your Google Drive.

Properties

NameLabelTypeDescriptionRequired
fileIdFile IDSTRINGID of the file to be retrieved.true

Example JSON Structure

{
  "label" : "Get File",
  "name" : "getFile",
  "parameters" : {
    "fileId" : ""
  },
  "type" : "googleDrive/v1/getFile"
}

Output

Type: OBJECT

Properties

NameTypeDescription
idSTRINGThe ID of the file.
kindSTRINGIdentifies what kind of resource this is.
mimeTypeSTRINGThe MIME type of the file.
nameSTRINGThe name of the file.

Output Example

{
  "id" : "",
  "kind" : "",
  "mimeType" : "",
  "name" : ""
}

Find File ID

To find the File ID, click here.

List Files

Name: listFiles

List files in a Google Drive folder.

Properties

NameLabelTypeDescriptionRequired
folderIdParent Folder IDSTRINGID of the folder from which you want to list files. If no folder is specified, the root folder will be used.false

Example JSON Structure

{
  "label" : "List Files",
  "name" : "listFiles",
  "parameters" : {
    "folderId" : ""
  },
  "type" : "googleDrive/v1/listFiles"
}

Output

Type: ARRAY

Items Type: OBJECT

Properties

NameTypeDescription
idSTRINGThe ID of the file.
kindSTRINGIdentifies what kind of resource this is.
mimeTypeSTRINGThe MIME type of the file.
nameSTRINGThe name of the file.

Output Example

[ {
  "id" : "",
  "kind" : "",
  "mimeType" : "",
  "name" : ""
} ]

Find Folder ID

To find the Folder ID, click here.

List Folders

Name: listFolders

List folders in a Google Drive folder.

Properties

NameLabelTypeDescriptionRequired
folderIdParent Folder IDSTRINGID of the folder from which you want to list folders. If no folder is specified, the root folder will be used.false

Example JSON Structure

{
  "label" : "List Folders",
  "name" : "listFolders",
  "parameters" : {
    "folderId" : ""
  },
  "type" : "googleDrive/v1/listFolders"
}

Output

Type: ARRAY

Items Type: OBJECT

Properties

NameTypeDescription
idSTRINGThe ID of the file.
kindSTRINGIdentifies what kind of resource this is.
mimeTypeSTRINGThe MIME type of the file.
nameSTRINGThe name of the file.

Output Example

[ {
  "id" : "",
  "kind" : "",
  "mimeType" : "",
  "name" : ""
} ]

Find Folder ID

To find the Folder ID, click here.

Share File

Name: shareFile

Share a specified file from your Google Drive.

Properties

NameLabelTypeDescriptionRequired
fileIdFile IDSTRINGID of the file to be shared.true

Example JSON Structure

{
  "label" : "Share File",
  "name" : "shareFile",
  "parameters" : {
    "fileId" : ""
  },
  "type" : "googleDrive/v1/shareFile"
}

Output

Type: STRING

Find File ID

To find the File ID, click here.

Share Folder

Name: shareFolder

Share a specified folder from your Google Drive.

Properties

NameLabelTypeDescriptionRequired
folderIdFolder IDSTRINGID of the folder to be shared.true

Example JSON Structure

{
  "label" : "Share Folder",
  "name" : "shareFolder",
  "parameters" : {
    "folderId" : ""
  },
  "type" : "googleDrive/v1/shareFolder"
}

Output

Type: STRING

Find Folder ID

To find the Folder ID, click here.

Upload File

Name: uploadFile

Uploads a file in your Google Drive.

Properties

NameLabelTypeDescriptionRequired
fileEntryFile EntryFILE_ENTRYThe object property which contains a reference to the file to upload.true
folderIdParent Folder IDSTRINGID of the folder where the file will be uploaded; if no folder is selected, the file will be uploaded to the root folder.false

Example JSON Structure

{
  "label" : "Upload File",
  "name" : "uploadFile",
  "parameters" : {
    "fileEntry" : {
      "extension" : "",
      "mimeType" : "",
      "name" : "",
      "url" : ""
    },
    "folderId" : ""
  },
  "type" : "googleDrive/v1/uploadFile"
}

Output

Sample Output:

{id=1hPJ7kjhStTX90amAWSJ-V0K1-nhDlsIr, mimeType=plain/text, name=new-file.txt}

Type: OBJECT

Properties

NameTypeDescription
idSTRINGThe ID of the file.
kindSTRINGIdentifies what kind of resource this is.
mimeTypeSTRINGThe MIME type of the file.
nameSTRINGThe name of the file.

Output Example

{
  "id" : "",
  "kind" : "",
  "mimeType" : "",
  "name" : ""
}

Find Folder ID

To find the Folder ID, click here.

Triggers

New File

Name: newFile

Triggers when new file is uploaded to Google Drive.

Type: POLLING

Properties

NameLabelTypeDescriptionRequired
folderIdParent Folder IDSTRINGThe ID of the folder where the new file is uploaded.true

Output

Type: ARRAY

Items Type: OBJECT

Properties

NameTypeDescription
idSTRINGThe ID of the file.
kindSTRINGIdentifies what kind of resource this is.
mimeTypeSTRINGThe MIME type of the file.
nameSTRINGThe name of the file.

JSON Example

{
  "label" : "New File",
  "name" : "newFile",
  "parameters" : {
    "folderId" : ""
  },
  "type" : "googleDrive/v1/newFile"
}

Find Folder ID

To find the Folder ID, click here.

New Folder

Name: newFolder

Triggers when new folder is uploaded to Google Drive.

Type: POLLING

Properties

NameLabelTypeDescriptionRequired
folderIdParent Folder IDSTRINGThe ID of the folder where the new folder is uploaded.true

Output

Type: ARRAY

Items Type: OBJECT

Properties

NameTypeDescription
idSTRINGThe ID of the file.
kindSTRINGIdentifies what kind of resource this is.
mimeTypeSTRINGThe MIME type of the file.
nameSTRINGThe name of the file.

JSON Example

{
  "label" : "New Folder",
  "name" : "newFolder",
  "parameters" : {
    "folderId" : ""
  },
  "type" : "googleDrive/v1/newFolder"
}

Find Folder ID

To find the Folder ID, click here.

What to do if your action is not listed here?

If this component doesn't have the action you need, you can use Custom Action to create your own. Custom Actions empower you to define HTTP requests tailored to your specific requirements, allowing for greater flexibility in integrating with external services or APIs.

To create a Custom Action, simply specify the desired HTTP method, path, and any necessary parameters. This way, you can extend the functionality of your component beyond the predefined actions, ensuring that you can meet all your integration needs effectively.


Additional Instructions

How to find File ID

To find a File ID, open the file in your browser. The ID is the long string of letters and numbers in the URL between /d/ and the next / (usually /view or /edit).

For example, in the URL https://drive.google.com/file/d/1234567890abcdefghijklmnopqrstuvwxyz/view, the File ID is 1234567890abcdefghijklmnopqrstuvwxyz.

The File ID can also be found in the output of the following actions and triggers:

  • Copy File
  • Create New Text File
  • Get File
  • List Files
  • Upload File
  • New File trigger

How to find Folder ID

To find a Folder ID, open the folder in your browser. The ID is the string of characters at the end of the URL after folders/.

For example, in the URL https://drive.google.com/drive/folders/abcjhadjh213102398890r4, the Folder ID is abcjhadjh213102398890r4.

The Folder ID can also be found in the output of the following actions and triggers:

  • Create New Folder
  • Get File
  • List Folders
  • New Folder trigger

Troubleshooting

Access Blocked: Verification Process Not Completed

Documentation for how to add a test user can be found here

How is this guide?

Last updated on

On this page