Skip to content

Drive — upload a file ​

Uploads the attachments (from the email or added by a step), or a text file you write, into a Google Drive folder.

This node puts files into the Google Drive of the member running the workflow: the attachments of the run (those of the triggering email and the files added by earlier steps, such as a document fetched from another service), or a text file whose content you write (a summary, a CSV line, some JSON).

It needs the Google Drive access of a Google account, shown as the Files capability in Connections. See Google. The workflow always runs with the account of the member who runs it, never with the account of the person who built it.

To give your uploads a destination, create the folder first with Drive — create a folder: it returns the folder id to plug into Destination folder. To find files that are already there, use Drive — search files. For OneDrive, use Upload to OneDrive; for a SharePoint library, the SharePoint node.

The Google access requested is the narrowest one Google offers (drive.file): the app only sees the files and folders it created itself. Uploading to the Drive root always works, but the Destination folder list only shows folders created by the app, and pasting the id or URL of a folder you created by hand in your browser fails with google.not_found. Create your destination folders with Drive — create a folder and they will always be reachable.

At a glance ​

  • Type: google_drive.upload · version 1
  • Category: Actions
  • Kind: Step — one stage of a run
  • Effect: Writes outside (external_write) — writes outside Mankomail; described instead of performed during a test run
  • 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)

source ​

What to upload

  • Type: One choice (options)
  • Required: Yes
  • Default: attachment
  • Options:
    • attachment — The attachments: Those of the triggering email and the files added by an earlier step (a fetched deed, a signed PDF), filtered as everywhere else.
    • text — A text file written here: Content produced by the workflow: a summary, a CSV line, some JSON.

selection ​

Attachments to use

  • Type: One choice (options)
  • Required: Yes
  • Default: all
  • Options:
    • all — All attachments: Those of the triggering email, then the files added by earlier steps (a fetched deed, a signed PDF), in that order.
    • first — The first one only: The first attachment, when only one matters.
    • byMime — By file type: By MIME type: application/pdf, or a whole family with image/*.
    • byName — By file name: By name pattern: *.pdf, invoice-*.
  • Shown when: source is attachment

mime ​

File type — Exact MIME type (application/pdf) or a whole family (image/*). Left empty, no attachment is kept.

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 200 characters at most
  • Example: application/pdf
  • Shown when: source is attachment and selection is byMime
  • Expressions: {{ }} accepted

namePattern ​

File name — Simple pattern: * matches anything, ? one character (*.pdf, invoice-*). Case is ignored.

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 200 characters at most
  • Example: *.pdf
  • Shown when: source is attachment and selection is byName
  • Expressions: {{ }} accepted

fileName ​

File name — Accepts {{ }} expressions: summary-{{ email.subject }}.txt.

  • Type: Text (string)
  • Required: Yes
  • Default: "" (empty)
  • 200 characters at most
  • Example: summary.txt
  • Shown when: source is text
  • Expressions: {{ }} accepted

content ​

Content — The file text. Accepts {{ }} expressions.

  • Type: Long text (text)
  • Required: No
  • Default: "" (empty)
  • 100000 characters at most
  • Shown when: source is text
  • Expressions: {{ }} accepted

contentMime ​

File type

  • Type: One choice (options)
  • Required: No
  • Default: text/plain
  • Options:
    • text/plain — text/plain
    • text/csv — text/csv
    • application/json — application/json
  • Shown when: source is text

folder ​

Destination folder — Left empty, the file lands at the Drive root. The list only shows folders created by the app — the price of minimal consent (drive.file).

  • 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

onConflict ​

If the name already exists

  • Type: One choice (options)
  • Required: Yes
  • Default: rename
  • Options:
    • rename — Keep both: Drive allows duplicate names: nothing is lost.
    • skip — Do nothing: Recurring filing: if the invoice is already there, skip it.
    • replace — Replace the content: The reference version: the file keeps its id and its link.

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 uploaded (or found again on a replay), in upload order. id is the Drive file id, webViewLink the link that opens the file in Google Drive, folderId the id of its parent folder, size the size in bytes when Google reports it.
  • {{ data.<step>.files.0.webViewLink }} — string. The Drive link of the first uploaded file, ready to paste into an email or a table. Absent in a test run.
  • {{ data.<step>.skipped }} — array of string. The names of the files that were not uploaded: a name already taken with If the name already exists set to Do nothing, an attachment purged in the meantime, or an attachment over 5 MB (listed as attachment <position> when its name is unknown).
  • {{ data.<step>.simulated }} — boolean. true in a test run: nothing was uploaded, the ids start with simulated- and there is no webViewLink.
  • {{ data.<step>.attachments }} — array of { position, filename, mime, size, origin, addedByNodeId?, integration? }. With What to upload set to The attachments: where each uploaded attachment comes from. origin is email (the triggering email) or added (a file added by an earlier step, whose id is in addedByNodeId). Empty for a text file.
  • {{ data.<step>.summary }} — string. A readable sentence describing what the step did, as shown in the run detail.

Example ​

Supplier invoices arrive by email and must be filed into a Drive folder per supplier. The workflow runs a Drive — create a folder step named Supplier folder (name {{ email.from.name }}), then this node, named Archive invoice:

source: attachment
selection: byMime
mime: application/pdf
folder: (id mode) {{ data.supplier_folder.folder.id }}
onConflict: skip

For an email carrying invoice-0412.pdf, the 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…"
    }
  ],
  "skipped": [],
  "simulated": false,
  "attachments": [
    { "position": 1, "filename": "invoice-0412.pdf", "mime": "application/pdf", "size": 48213, "origin": "email" }
  ]
}

A later Compose step can quote {{ data.archive_invoice.files.0.webViewLink }}.

Tips ​

  • Destination folder. Three modes: pick from the list, type an id, or paste the folder URL from your browser (https://drive.google.com/drive/folders/<id>, including the /u/0/ variant and a trailing ?usp=sharing). Left empty, the file lands at the Drive root. A pasted value that is neither an id nor a recognised Drive URL fails with google.bad_locator.
  • Name conflicts. Keep both (rename, the default) creates a second file with the same name, which Drive allows. Do nothing (skip) leaves the existing file alone and lists the name in skipped. Replace the content (replace) overwrites the existing file, which keeps its id and its link.
  • No duplicate on replay. Each uploaded file carries a hidden marker tied to the step. When the step is replayed after an incident, the node finds the file uploaded by the first attempt and returns it instead of uploading it again, whatever the conflict setting.
  • How many. At most 20 attachments per step, as for OneDrive and SharePoint: beyond that, the first 20 matching ones are uploaded.
  • Attachment size. Attachments over 5 MB are skipped and listed in skipped; the others are still uploaded. An attachment purged from storage is skipped the same way.
  • Nothing selected. If no attachment matches the selection, the step fails with node_nothing_to_do rather than reporting an empty upload.
  • Text files. With A text file I write, File name is required (node_invalid_param when it resolves to empty) and File type is text/plain, text/csv or application/json.
  • Test runs. In test runs nothing is uploaded: the step returns the names it would have uploaded, with ids starting with simulated-, no webViewLink and simulated: true. The run detail lists the upload under what would have happened.
  • Errors. credential.capability_missing: Google Drive is not connected for the member running the workflow; connect it in Connections. google.insufficient_permissions or google.auth_failed: the access was withdrawn or refused; reconnect the account. google.not_found: the folder does not exist or the app cannot see it. google.unavailable (quota, outage) is retried automatically. See Error handling.