Skip to main content

Upload Files to Google Drive from AnyDB with Zapier

Upload files to Google Drive from AnyDB with Zapier​

This Zap copies every file uploaded to AnyDB into a Google Drive folder, once per file, after the upload has finished. It has three steps:

The finished Zap: AnyDB Updated Record, Webhooks by Zapier GET, Google Drive Upload File

StepApp and eventWhat it does
1AnyDB → Updated Recordfires when a File record's file cell A1 is written with the finished upload
2Webhooks by Zapier → GETasks AnyDB for a short-lived download link to that file
3Google Drive → Upload Filedownloads the file from the link and saves it to Drive
note

You need AnyDB Zapier app 1.2.1 or later for the Record Type and optional Record ID fields, and your AnyDB API key from the Profile dialog. The screenshots below were taken against a test server (dev1.anydb.com); use https://app.anydb.com, or your own AnyDB server address, everywhere they show it. IDs, the API key and the email are blacked out.

Step 1: Trigger, AnyDB → Updated Record​

  1. Create a Zap and choose AnyDB as the trigger app, with the event Updated Record.
  2. Connect your AnyDB account: AnyDB URL https://app.anydb.com, your email, and your API key.
  3. On Configure, fill in:
FieldValueWhy
Teamyour team
Databaseyour database
Record ID(empty)not watching one particular record
Parent Record ID(empty), or a folder's record IDempty watches every file in the database. A folder's ID watches only files uploaded directly into that folder
Record TypeFileonly File records, the records AnyDB creates for uploaded files
Cell IDsA1A1 is a File record's file cell, written once the upload completes
Filter(empty), or a conditionfor example '{{context:meta.name}}' ENDSWITH '.pdf'. See Filter syntax
Record ID: also watch its childreneitherignored when Record ID is empty

Step 1 Configure: Team, Database, Record Type File, Cell IDs A1

  1. On Test, pick a record and continue. When the Zap runs, step 1 hands on the uploaded file's record. These are the values the next steps use:

Step 1 data from a real run: Record ID, Record Name IMG_3940.jpg, Database ID, Team ID, Cell Position A1, and the file details

Field in ZapierKeyUsed for
Team IDteamidthe download request
Database IDadbidthe download request
Record IDadoidthe download request
Record Namenamethe file name in Drive. For a file it is the name with its extension, e.g. IMG_3940.jpg

Step 2: Action, Webhooks by Zapier → GET​

  1. Add an action: Webhooks by Zapier, event GET.
  2. On Configure, fill in:
FieldValue
URLhttps://app.anydb.com/api/integrations/ext/download
Query String Paramsteamid → step 1 Team ID; adbid → step 1 Database ID; cellpos → A1; adoid → step 1 Record ID
Send As JSONNo
UnflattenYes (the default)
HeadersX-ANYDB-API-KEY → your AnyDB API key; X-ANYDB-EMAIL → your AnyDB email

Step 2 Configure: URL and the four query string params mapped from step 1

Step 2 Headers: X-ANYDB-API-KEY and X-ANYDB-EMAIL (values hidden)

The request this sends looks like this:

Step 2 Data in: url and data with teamid, adbid, cellpos A1 and adoid

  1. AnyDB answers with Status success and Data, a short-lived link to the file (hidden below). Step 3 uses Data.

Step 2 Data out: Status success, Data holds the download link

The raw response is:

{ "status": "success", "data": "https://<storage-host>/<path>?X-Amz-Signature=..." }

Step 3: Action, Google Drive → Upload File​

  1. Add an action: Google Drive, event Upload File, and connect your Google account.
  2. On Configure, fill in:
FieldValue
DriveMy Google Drive, or a shared drive
Folderthe folder for the copies
Filestep 2 Data. Zapier downloads the file from the link
Convert to Document?False
File Name(optional) step 1 Record Name. Empty keeps the name from the link
File Extension(empty)

Step 3 Configure: Drive, Folder, File mapped to step 2 Data

Turn it on and test​

Publish the Zap, then upload a file to AnyDB, into the folder if you set a Parent Record ID. Within a few seconds Zap History shows one successful run (2 tasks), and the file appears in Drive.

If it does not work​

SymptomFix
No runRecord Type must be File and Cell IDs A1. The AnyDB user must be able to read the file.
Two runs per uploadYour AnyDB server predates the fix that ignores the upload's placeholder write. Ask your AnyDB administrator to update it.
Step 2 returns 401 or 403Check the X-ANYDB-EMAIL and X-ANYDB-API-KEY headers, and that the user can read the record.
Turning the Zap on fails with A record, a parent record, a type or a filter is requiredSet Record Type, or a Parent Record ID.

The same flow in Make is in Upload files to Google Drive from AnyDB with Make.