Procedures
Automation procedures in the Google Drive BDK Book.
Make sure to add the Google Drive BDK Book to your agent before using these automation procedures.
to copy an item to a folder
Copy an item to a folder
Input Concepts
item
The item (file or folder) to copy
drive file reference
or drive folder reference
Yes
conflict behavior
The behavior to use on conflict scenarios. It should be one of the following values: ('fail', 'replace', 'rename')
text
No
Examples
Copy an item to a folder
get a folder at "Folder1/Folder2"
use the above as the base folder
copy the uploaded file to the base folder
Copy an item to a folder with a conflict behavior
get a folder at "Folder1/Folder2"
use the above as the testing folder
get a folder at "Folder1/Folder2/Conflictive Folder"
use the above as the conflictive folder
copy the conflictive folder to the testing folder
the conflict behavior is "rename"
to create a (folder) in another folder
Create a (folder) in another folder
Input Concepts
folder name
The name of the (folder) to create
text
Yes
conflict behavior
The behavior to use on conflict scenarios. It should be one of the following values: ('fail', 'replace', 'rename')
text
No
Output Concepts
Examples
Create a folder in Google Drive
get a root folder
use the root folder as the base folder
create a folder in the base folder
the folder name is "My Test Folder"
Create a folder in Google Drive, with 'rename' as the conflict behavior
get a folder at "Folder1/Folder2"
use the folder as the base folder
create a folder in the base folder
the folder name is "My Test Folder"
the conflict behavior is "rename"
to delete an item
Delete an item (file or folder)
Input Concepts
item
The item (file or folder) to delete
drive file reference
or drive folder reference
Yes
Examples
Delete an item
get a folder at "Folder1/Folder2"
get the folder's items
use the first item as the file
delete the file
to download a file
Download a file
Input Concepts
Output Concepts
answer
the file as an IO object
file
Examples
Download a file
get a folder at "Folder1/Folder2"
get the folder's items
use the first item as the file
download the file
to get a (folder) at a path
Gets a reference to a folder.
Google Drive allows for multiple folders with the same name in a parent folder. For now, as the blueprint interface returns only one reference, it is returning the first item on the returned list. In case there are more than one folder with the same name, an error will be raised. In the future, this may change to a list of FolderReferences.
Input Concepts
path
The path to the folder
text
Yes
Output Concepts
Examples
Get a folder at the path 'The Folder/The Subfolder'
get a folder at "The Folder/The Subfolder"
to get a (root folder)
Gets a reference to the root folder.
Output Concepts
Examples
Get a root folder
get a root folder
to get some (folder's items)
Lists items from a folder reference
Input Concepts
Output Concepts
folder's items
a list of Items (file or folder) containing the items in the folder
drive file reference
or drive folder reference
Examples
List items in a folder
get a folder at "Folder1/Folder2"
get the folder's items
to move an item to a folder
Move an item to a folder
Input Concepts
item
The item (file or folder) to move
drive file reference
or drive folder reference
Yes
conflict behavior
The behavior to use on conflict scenarios. It should be one of the following values: ('fail', 'replace', 'rename')
text
No
Examples
Move an item to a folder
get a folder at "Folder1/Folder2"
get the folder's items
use the first item as the file
get a folder at "Folder1/Folder2/Folder3"
use the above as the new folder
move the file to the new folder
Move an item to a folder with a conflict behavior
get a folder at "Folder1/Folder2"
get the folder's items
use the first item as the file
get a folder at "Folder1/Folder2/Folder3"
use the above as the new folder
move the file to the new folder
the conflict behavior is "rename"
to rename an item to a name
Rename an item (file or folder) to a given name
Input Concepts
item
The item (file or folder) to rename
drive file reference
or drive folder reference
Yes
name
The new name of the item
text
Yes
conflict behavior
The behavior to use on conflict scenarios. It should be one of the following values: ('fail', 'replace', 'rename')
text
No
Examples
Rename an item to a new name
get a folder at "Folder1/Folder2"
get the folder's items
use the first item as the file
rename the file to "The new name.jpg"
Rename an item to a new name, with 'rename' as the conflict behavior
get a folder at "Folder1/Folder2"
get the folder's items
use the first item as the file
rename the file to "The new name.jpg"
the conflict behavior is "rename"
to upload a (file) to a folder
Upload a file to a folder
Input Concepts
file
The file to upload
file
Yes
file name
The name of the file to upload
text
Yes
conflict behavior
The behavior to use on conflict scenarios. It should be one of the following values: ('fail', 'replace', 'rename')
text
No
Output Concepts
Examples
Upload a file to a folder
# Upload a file to the Playground
the file
get a folder at "Folder1/Folder2"
upload the file to the folder
the file name is "uploaded-file.jpg"
Upload a file to a folder with a conflict behavior
# Upload a file to the Playground
the file
get a folder at "Folder1/Folder2"
upload the file to the folder
the file name is "uploaded-file.jpg"
the conflict behavior is "rename"
Last updated
Was this helpful?