English
Drive — search files
Searches files in Google Drive and puts the list into the working data. It is a read: it runs for real, even during a test run.
This node searches Google Drive and puts the list of matching files into the working data, for instance to check that a document was already filed, to link to it in a reply, or to iterate over a folder with a Loop.
It needs the Google Drive access of a Google account, shown as the Files capability in Connections. See Google. The search runs with the account of the member running the workflow.
The access requested is drive.file: the app only sees the files and folders it created itself, for instance with Drive — upload a file or Drive — create a folder. Files you put in Drive by hand do not show up in the results.
At a glance
- Type:
google_drive.search· version 1 - Category: Data
- Kind: Step — one stage of a run
- Effect: No external effect (
none) — nothing is written outside Mankomail; safe to replay - Needs a carrier email: No
- Connection: Google (capability
drive) - Inputs:
main - Outputs:
main
Connection
This node needs a Google connection with the drive capability granted.
Parameters
credential
Google account — The account holding Google Drive access. Connect it once in Connections; the workflow always runs with the account of the member running it.
- Type: Connection (
credential) - Required: Yes
- Default:
""(empty)
query
Name contains — Accepts {{ }} expressions. Left empty, every file of the folder comes back.
- Type: Text (
string) - Required: No
- Default:
""(empty) - 200 characters at most
- Example:
invoice - Expressions:
{{ }}accepted
folder
In folder — Left empty, the search covers everything the app can see.
- Type: Remote resource (
resourceLocator) - Required: No
- Ways to choose: pick from a list, type an ID, paste a URL (
drive.folder) - Listed with the connection in:
credential
mimeType
File type — Exact MIME type (application/pdf). Left empty, no type filter.
- Type: Text (
string) - Required: No
- Default:
""(empty) - 200 characters at most
- Example:
application/pdf - Expressions:
{{ }}accepted
limit
Result count
- Type: Number (
number) - Required: No
- Default:
20 - Whole number, from 1 to 50
Outputs
main
Data produced
What this node adds to the run data, and how to read it in an expression. <step> stands for the step key: the node name turned into an identifier (see Data and expressions).
{{ data.<step>.files }}—array of { id, name, mime, size?, webViewLink?, folderId? }. The files found, most recently modified first.idis the Drive file id,mimeits MIME type (application/vnd.google-apps.folderfor a folder),webViewLinkthe link that opens it in Google Drive,folderIdthe id of its parent folder,sizeits size in bytes when Google reports it.{{ data.<step>.files.0.id }}—string. The id of the most recently modified file found.{{ data.<step>.count }}—number. The number of files found.0when nothing matches.{{ data.<step>.summary }}—string. A readable sentence giving the number of files found.
Example
Before filing an invoice, a workflow checks whether a file with the same reference is already in the supplier folder. The node is named Find invoice:
query: {{ data.extract.reference }}
folder: (id mode) {{ data.supplier_folder.folder.id }}
mimeType: application/pdf
limit: 5The step data reads:
json
{
"files": [
{
"id": "1Hc9…",
"name": "invoice-0412.pdf",
"mime": "application/pdf",
"size": 48213,
"webViewLink": "https://drive.google.com/file/d/1Hc9…/view",
"folderId": "1TxK9…"
}
],
"count": 1
}A Condition (If) on {{ data.find_invoice.count }} then decides whether to upload.
Tips
- Matching. Name contains matches part of the file name (Drive's
name contains). Left empty, every file the filters let through comes back. File type is an exact MIME type (application/pdf); left empty, there is no type filter. Files in the trash are never returned. - Folder. In folder only looks at the direct children of the folder, not its subfolders. Left empty, the search covers everything the app can see. The folder can be picked from the list, typed as an id or pasted as a Drive folder URL.
- Result count. Between 1 and 50, 20 by default.
- Test runs. A search is a read: in test runs it really queries Google Drive and returns the real files.
- Errors.
credential.capability_missing: Google Drive is not connected for the member running the workflow.google.not_found: the folder does not exist or the app cannot see it.google.bad_locator: the pasted folder value is neither an id nor a recognised Drive URL.google.unavailableis retried automatically. See Error handling.