Google Drive
Google Drive
The Google Drive module is responsible for actions that integrate the Google Drive tool. Its methods can be accessed as in the example below:
const driveConnection = await API.Google.Drive.Connection["v1_0_0"]({
connectionId: "id-da-conexao-configurada-no-workspace",
});
The Connection action returns an authenticated Google Drive connection instance directly (not a text ID). This instance must be stored in a variable — such as driveConnection in the examples below — and reused in the driveConnection parameter of every other action of this module.
Methods
Connection
Method responsible for establishing a connection with Google Drive from a connection configured in the workspace.
const driveConnection = await API.Google.Drive.Connection["v1_0_0"]({
connectionId: "id-da-conexao-configurada-no-workspace",
});
Required parameters
connectionId:String - expects the ID of the Google connection configured in the workspace (Workspace → Connections).
Optional parameters
This method has no optional parameters.
Return
It returns the authenticated Google Drive connection instance, which must be stored in a variable (e.g. driveConnection) and reused as the driveConnection parameter in the other methods of this module.
EmptyTrash
Method responsible for emptying the trash of a specific drive or of the default "My Drive", permanently deleting every item it contains.
await API.Google.Drive.EmptyTrash["v1_0_0"]({
driveConnection: driveConnection,
name: "",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.
Optional parameters
name:String - expects the name of the drive whose trash will be emptied. If it is not provided, it empties the trash of the "My Drive" of the authenticated account.
Return
This method has no return.
Drives.List
Method responsible for listing every drive available to the authenticated account, including shared drives.
const drivesList = await API.Google.Drive.Drives.List["v1_0_0"]({
driveConnection: driveConnection,
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.
Optional parameters
This method has no optional parameters.
Return
actions.drivesList.drives // lista de drives disponíveis, cada item contendo id e name (Array)
Drives.GetByName
Method responsible for getting the information of a specific drive by its name.
const drive = await API.Google.Drive.Drives.GetByName["v1_0_0"]({
driveConnection: driveConnection,
name: "Drive Compartilhado",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.name:String - expects the exact name of the drive to be located.
Optional parameters
This method has no optional parameters.
Return
actions.drive.id // identificador único do drive (String)
actions.drive.name // nome do drive (String)
If no drive is found with the name provided, the execution is interrupted with an error.
Files.List
Method responsible for listing the files in a specific folder of Google Drive.
const filesList = await API.Google.Drive.Files.List["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
path: "/Documentos",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.path:String - expects the path of the folder whose files will be listed. Use/to list the root of the drive.
Optional parameters
drive:String - expects the name of the drive to be accessed. Default:"root"(My Drive).
Return
actions.filesList.files // lista de arquivos encontrados, cada item contendo id, name e extension (Array)
Files.GetByName
Method responsible for getting the detailed information of a file from its path in Google Drive.
const file = await API.Google.Drive.Files.GetByName["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
path: "/Documentos/relatorio.pdf",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.path:String - expects the full path of the file, including the name and extension.
Optional parameters
drive:String - expects the name of the drive to be accessed. Default:"root"(My Drive).
Return
actions.file.id // identificador único do arquivo (String)
actions.file.name // nome do arquivo (String)
actions.file.extension // extensão do arquivo (String)
actions.file.createdTime // data de criação (String)
actions.file.modifiedTime // data da última modificação (String)
actions.file.shared // indica se o arquivo está compartilhado (Boolean)
If the file is not found, the execution is interrupted with an error.
Files.Exists
Method responsible for checking whether a file exists at a specific path of Google Drive.
const fileExists = await API.Google.Drive.Files.Exists["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
path: "/Documentos/relatorio.pdf",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.path:String - expects the full path of the file to check, including the name and extension.
Optional parameters
drive:String - expects the name of the drive to be accessed. Default:"root"(My Drive).
Return
actions.fileExists.exists // verdadeiro se o arquivo existe, falso caso contrário (Boolean)
This action never interrupts the execution for not finding the file — use the exists return for conditional flow control.
Files.Download
Method responsible for downloading a file from Google Drive to a local path.
const download = await API.Google.Drive.Files.Download["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
remotePath: "/Documentos/relatorio.pdf",
localPath: "C:\\Downloads\\relatorio.pdf",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.remotePath:String - expects the full path of the file in Google Drive, including the name and extension.localPath:String - expects the local path where the file will be saved, including the file name.
Optional parameters
drive:String - expects the name of the origin drive. Default:"root"(My Drive).
Return
actions.download.downloadPath // caminho local completo onde o arquivo foi salvo (String)
Files.Upload
Method responsible for uploading a local file to a specific path in Google Drive.
const upload = await API.Google.Drive.Files.Upload["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
remotePath: "/Documentos/relatorio.pdf",
localPath: "C:\\Relatorios\\relatorio.pdf",
createFoldersIfNecessary: false,
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.remotePath:String - expects the full destination path in Google Drive, including the file name and extension.localPath:String - expects the full path of the local file to be sent.
Optional parameters
drive:String - expects the name of the destination drive. Default:"root"(My Drive).createFoldersIfNecessary:Boolean - when it istrue, it automatically creates the destination path folders that do not exist yet. If it is not provided and the destination path does not exist, the execution is interrupted with an error.
Return
actions.upload.id // identificador único do arquivo criado no Google Drive (String)
Files.Rename
Method responsible for renaming a file in Google Drive.
const rename = await API.Google.Drive.Files.Rename["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
path: "/Documentos/relatorio_antigo.pdf",
newName: "relatorio_2026.pdf",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.path:String - expects the full path of the file to be renamed, including the name and extension.newName:String - expects the new name for the file, including the extension.
Optional parameters
drive:String - expects the name of the drive to be accessed. Default:"root"(My Drive).
Return
actions.rename.name // novo nome do arquivo após a renomeação (String)
Files.Move
Method responsible for moving a file to a new destination, which can be on a different drive.
const move = await API.Google.Drive.Files.Move["v1_0_0"]({
driveConnection: driveConnection,
originDrive: "",
destinationDrive: "",
path: "/Documentos/relatorio.pdf",
newParentPath: "/Arquivo/2026",
createFoldersIfNecessary: false,
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.path:String - expects the full path of the file to be moved, including the name and extension.newParentPath:String - expects the path of the destination folder.
Optional parameters
originDrive:String - expects the name of the drive where the file currently is. Default:"root"(My Drive).destinationDrive:String - expects the name of the drive the file will be moved to. Default: the same origin drive.createFoldersIfNecessary:Boolean - when it istrue, it automatically creates the destination path folders that do not exist yet. If it is not provided and the destination does not exist, the execution is interrupted with an error.
Return
actions.move.newParentId // identificador único da pasta pai de destino (String)
Files.Trash
Method responsible for moving a file to the Google Drive trash.
await API.Google.Drive.Files.Trash["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
path: "/Documentos/relatorio_antigo.pdf",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.path:String - expects the full path of the file to be moved to the trash, including the name and extension.
Optional parameters
drive:String - expects the name of the drive to be accessed. Default:"root"(My Drive).
Return
This method has no return. The file can be restored using the Files.RestoreFromTrash method, or deleted permanently with the EmptyTrash method.
Files.RestoreFromTrash
Method responsible for restoring a file from the trash to its original location in Google Drive.
await API.Google.Drive.Files.RestoreFromTrash["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
path: "/Documentos/relatorio_antigo.pdf",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.
Optional parameters
drive:String - expects the name of the drive to be accessed. Default:"root"(My Drive).path:String - expects the path the file had before it was moved to the trash, including the name and extension. Although it is technically optional (with the default value"/"), this field must always be provided so the right file is located and restored.
Return
This method has no return.
Folders.List
Method responsible for listing the folders at a specific path of Google Drive.
const foldersList = await API.Google.Drive.Folders.List["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
path: "/Documentos",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.path:String - expects the path of the folder to be listed. Use/to list the root of the drive.
Optional parameters
drive:String - expects the name of the drive to be accessed. Default:"root"(My Drive).
Return
actions.foldersList.folders // lista de pastas encontradas, cada item contendo id e name (Array)
Folders.GetByName
Method responsible for getting the detailed information of a folder from its path in Google Drive.
const folder = await API.Google.Drive.Folders.GetByName["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
path: "/Documentos/Relatórios",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.path:String - expects the full path of the folder.
Optional parameters
drive:String - expects the name of the drive to be accessed. Default:"root"(My Drive).
Return
actions.folder.id // identificador único da pasta (String)
actions.folder.name // nome da pasta (String)
actions.folder.createdTime // data de criação (String)
actions.folder.modifiedTime // data da última modificação (String)
actions.folder.shared // indica se a pasta está compartilhada (Boolean)
If the folder is not found, the execution is interrupted with an error.
Folders.Create
Method responsible for creating a new folder at a specific path of Google Drive.
const folderCreated = await API.Google.Drive.Folders.Create["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
path: "/Documentos/Relatórios/2026",
recursive: false,
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.path:String - expects the full path of the folder to be created, including the name.
Optional parameters
drive:String - expects the name of the drive where the folder will be created. Default:"root"(My Drive).recursive:Boolean - when it istrue, it automatically creates every folder of the path that does not exist yet. If it is not provided and some folder of the path does not exist, the execution is interrupted with an error.
Return
actions.folderCreated.id // identificador único da pasta criada no Google Drive (String)
Folders.Exists
Method responsible for checking whether a folder exists at a specific path of Google Drive.
const folderExists = await API.Google.Drive.Folders.Exists["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
path: "/Documentos/Relatórios",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.path:String - expects the full path of the folder to check.
Optional parameters
drive:String - expects the name of the drive to be accessed. Default:"root"(My Drive).
Return
actions.folderExists.exists // verdadeiro se a pasta existe, falso caso contrário (Boolean)
This action never interrupts the execution for not finding the folder — use the exists return for conditional flow control.
Folders.Rename
Method responsible for renaming a folder in Google Drive.
await API.Google.Drive.Folders.Rename["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
path: "/Documentos/Relatórios",
newName: "Relatórios Antigos",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.path:String - expects the full path of the folder to be renamed.newName:String - expects the new name for the folder.
Optional parameters
drive:String - expects the name of the drive to be accessed. Default:"root"(My Drive).
Return
This method has no return.
Folders.Move
Method responsible for moving a folder to a new destination inside Google Drive.
const folderMove = await API.Google.Drive.Folders.Move["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
path: "/Documentos/Relatórios",
newParentPath: "/Arquivo/2026",
createFoldersIfNecessary: false,
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.path:String - expects the full path of the folder to be moved.newParentPath:String - expects the path of the destination folder.
Optional parameters
drive:String - expects the name of the drive to be accessed. Default:"root"(My Drive).createFoldersIfNecessary:Boolean - when it istrue, it automatically creates the destination path folders that do not exist yet. If it is not provided and the destination does not exist, the execution is interrupted with an error.
Return
actions.folderMove.newParentId // identificador único da pasta pai de destino (String)
Folders.Trash
Method responsible for moving a folder to the Google Drive trash.
await API.Google.Drive.Folders.Trash["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
path: "/Documentos/Antigos",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.path:String - expects the full path of the folder to be moved to the trash.
Optional parameters
drive:String - expects the name of the drive to be accessed. Default:"root"(My Drive).
Return
This method has no return. The folder can be restored using the Folders.RestoreFromTrash method, or deleted permanently with the EmptyTrash method.
Folders.RestoreFromTrash
Method responsible for restoring a folder from the trash to its original location in Google Drive.
await API.Google.Drive.Folders.RestoreFromTrash["v1_0_0"]({
driveConnection: driveConnection,
drive: "",
pathBeforeTrash: "/Documentos/Antigos",
});
Required parameters
driveConnection:Object - expects the connection instance obtained by the Connection method.pathBeforeTrash:String - expects the path the folder had before it was moved to the trash.
Optional parameters
drive:String - expects the name of the drive to be accessed. Default:"root"(My Drive).
Return
This method has no return.