Google Drive — Create folder
Google Drive — Create folder
Section titled “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.
How it works
Section titled “How it works”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.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | — | Folder name. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanGoogleDriveSession | — | Session from Google Drive — Connect. Inside Connect’s body it is inherited and you can leave it empty. |
folderId | string | — | Parent folder ID. If empty, the root of My Drive. |
Output
Section titled “Output”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.
Common errors
Section titled “Common errors”| Message | Cause 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. |
Example
Section titled “Example”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 = monthIdRelated activities
Section titled “Related activities”- Google Drive — Upload — upload files to the folder.
- Google Drive — Move — move files to the folder.
- Google Drive — List files — list its content.
- All Google Drive activities