Google Drive
1 day trial then $20.00/month - No credit card required now
Google Drive
1 day trial then $20.00/month - No credit card required now
Transfer files between Apify's key-value stores and Google Drive.
Transfer files between Apify's key-value stores and Google Drive.
Input
The input is a JSON object with the following fields.
Field | Type | Description | Default value | Possible values | Required |
---|---|---|---|---|---|
constants | array | Constants to use in the operations | - | - | false |
constants[*] | object | Constant settings | - | - | - |
constants[name] | string | Constant name | - | - | true |
constants[value] | string or Object | Constant value | - | - | true |
operations | array | The operations to execute | - | - | false |
operations[*] | Object | Operation settings, mainly it contains the type and other specific settings | - | - | - |
fileUploadTimeoutSecs | number | Maximum available time (in seconds) used to upload a single file | 120 | - | false |
fileUploadingMaxConcurrency | number | Maximum concurrency used for uploading files in parallel | - | - | false |
isSetupMode | boolean | Whether yes or no to activate the setup mode | false | - | false |
googleOAuthTokensStore | string | Key-value store where your Google OAuth tokens will be stored so you don't have to authorize every time again | "google-oauth-tokens" | - | false |
googleOAuthCredentials | object | Google OAuth credentials | - | - | false |
Constants
An array of folder info constants to use by the operations (DRY principle). Each constant is a JSON object composed of two fields: name and value.
Constant value as string
Represent the path of the folder
Example
1{ 2 "name": "myFolder", 3 "value": "my-project/files" 4}
Constant value as object
Provide more folder definition, which can be useful for defining a shared folder.
Example
1{ 2 "name": "myFolder", 3 "value": { 4 "parentFolderId": "GoogleDriveFolderId", 5 "path": "files" 6 } 7}
Constant usage
We use the constant inside a string with the following format "constants.[CONSTANT_NAME]"
.
Example
1{ 2 "type": "folders-delete", 3 "folder": "constants.myFolder" 4 }
Operations
Operations are the backbone. Each operation is an object and distinguished by the type field. The field type can have one the following values: upload, and folders-delete.
For each operation type there are specific settings that accompany as explained below:
Operation "upload"
Upload files from the key-value stores to a Google Drive folder.
Field | Type | Description | Default value | Possible values | Required |
---|---|---|---|---|---|
source | object | Represent the file(s) to upload | - | - | true |
source.idOrName | string | The ID or name of the key-value store | - | - | true |
source.forceCloud | boolean | Forcibly use the key-value store from the cloud | false | - | false |
source.files | array | File(s) to apply the operation on them | |||
source.files[*] | object | File(s) settings | - | - | true |
source.files[key] | string | The key of the file on the key-value store | - | - | true |
source.files[name] | string | The name of upload file on Google Drive | - | - | false |
source.files[mimeType] | string | The Google Drive MIME type of the file | - | Google Drive MIME types | false |
destination | string / object | Info of the Google Drive's folder where we will upload the file(s) | - | - | true |
Example
1{ 2 "type": "upload", 3 "source": { 4 "idOrName": "my-store", 5 "files": [ 6 { 7 "key": "my_spreadsheet", 8 "name": "My spreadsheet", 9 "mimeType": "application/vnd.google-apps.spreadsheet" 10 }, 11 { 12 "key": "my_image", 13 "name": "My Image" 14 } 15 ] 16 }, 17 "destination": "My actor files" 18 }
Operation "folders-delete"
Delete a folder. This operation type is useful for deleting folders before uploading files to prevent file duplication.
Field | Type | Description | Default value | Possible values | Required |
---|---|---|---|---|---|
folder | string / object | Info of the Google Drive's folder to delete | - | - | true |
Example:
1{ 2 "type": "folders-delete", 3 "folder": "My Folder" 4}
Is setup mode
Before you start using the actor for running operations, you will need to run it in the setup mode. To achieve that, you need to run it with the bellow input and follow the steps in the run's log ( for more info, check this article).
1{ 2 "isSetupMode": true 3}
Note: If the setup mode is activated, operations will not get executed.
Actor Metrics
2 monthly users
-
2 stars
67% runs succeeded
0.17 hours response time
Created in Apr 2020
Modified 2 months ago