Skip to content

Google Drive — Create folder

Type: googledrive-create-folder  ·  Package: Google Drive v1.0.5  ·  Output: Dictionary<string,object>

Creates a folder in Google Drive and returns its data (including the ID), which you will usually use as the destination when uploading or moving files: one folder per month, per customer or per processed batch.

Without folderId, the folder is created in the root of My Drive. To nest it inside another folder, pass the parent folder ID.

It always creates a new folder: Drive allows duplicate names, so running it twice with the same name leaves two folders with different IDs. If the folder may already exist, look for it first with List files (query = "name = 'Invoices 2026' and mimeType = 'application/vnd.google-apps.folder'") and create it only if the list is empty.

ParameterTypeDefaultDescription
namestring—Folder name.
ParameterTypeDefaultDescription
sessionZoanGoogleDriveSession—Session from Google Drive — Connect. Inside Connect’s body it is inherited and you can leave it empty.
folderIdstring—Parent folder ID. If empty, the root of My Drive.

Returns a Dictionary with the folder metadata (isFolder is true and size is null). Use folder["id"] as the destination folderId in Upload, Move or to create a subfolder.

MessageCause and fix
'name' is required.name is empty or its expression returned null.
No Google Drive session available. Provide 'session' from a googledrive-connect activity, or place this activity inside the Connect activity's body …The activity is outside Connect’s body and received no session. Move it inside the body or pass the saved session.
The service drive has thrown an exception. HttpStatusCode is …Google rejected the call: unknown ID or no access, expired token or quota exceeded. See Google API errors.

Create the month’s folder only if it does not exist:

Google Drive — Connect credential = credential("drive-operations")
└─ body:
Google Drive — List files folderId = invoicesId
query = "name = '2026-06' and mimeType = 'application/vnd.google-apps.folder'"
→ output: existing
If condition = existing.Count == 0
├─ then:
│ Google Drive — Create folder name = "2026-06" folderId = invoicesId → output: folder
│ Set Variable name = monthId value = folder["id"]
└─ else:
Set Variable name = monthId value = existing[0]["id"]
Google Drive — Upload path = "C:\inv\001.pdf" folderId = monthId