capabilities.work

Upsert a File by Name

A 3-step recipe with Google Drive. We can help you get access.

Recipe · 3 steps

Upsert a File by Name

Upsert a single file into a Google Drive folder by its name.

  1. Search the target folder for a non-trashed file whose name matches the supplied file name, returning at most one match.
  2. Patch the matched file's metadata with the supplied name and MIME type. Only the fields provided are changed; the file's content, parents, and sharing are left intact.
  3. Create a new file in the target folder when no existing file matched the supplied name.
What you'll need to have ready
  • folderId: The ID of the folder to upsert the file into.
  • fileName: The name of the file to match on and write (e.g. "Q3 Report").
  • mimeType: The MIME type of the file (e.g. application/vnd.google-apps.document).
For your developer

Arazzo workflow google-drive:upsert-file-by-name, 3 operations: listFiles → updateFile → createFile. Specs on APIs.io.