Merge Files in a Google Drive Folder Using PDF.co and Zapier
In this tutorial, we will guide you through the steps to combine supported files from a Google Drive folder into one PDF on a schedule, then save the result to another folder.
This example processes files directly inside the selected folder, not its subfolders. It requires the complete file list to fit in one API response; additional result pages must be retrieved before merging larger folders.
Step 1: Prepare Your Folders
Create separate input and output folders in My Drive. Put at least two supported files in the input folder.
This workflow uses direct download links. Use only documents approved for Anyone with the link → Viewer access, with downloading enabled. Do not use this sharing method for confidential files. See Google Drive’s sharing guide.
Copy the input folder’s ID from its browser URL. Use numbered filenames, such as 01-introduction.pdf, to control the merge order.
Step 2: Set the Schedule
Create a Zap and select Schedule by Zapier → Every Day.
Choose the time and weekend preference, then test the trigger. Schedule uses your Zapier account’s timezone.
Step 3: List the Folder’s Files
Add Google Drive → API Request (Beta) and connect your account.
Set:
- HTTP Method: GET.
- URL:
https://www.googleapis.com/drive/v3/files - Stop on error: Yes.
Add these query parameters:
q:'YOUR_FOLDER_ID' in parents and trashed = false and mimeType != 'application/vnd.google-apps.folder'pageSize:1000orderBy:name_naturalfields:nextPageToken,incompleteSearch,files(id,name,mimeType,webContentLink,exportLinks)
Replace YOUR_FOLDER_ID with your input folder ID. Leave the request body empty and test the action.
See Google’s files.list documentation for query and pagination details.
Step 4: Prepare the Download Links
Add Code by Zapier → Run Python.
Under Input Data, create the key folder_data and map the Google Drive API request’s Response Body to it.
Paste:
import json
data = json.loads(input_data["folder_data"])
if data.get("nextPageToken") or data.get("incompleteSearch"):
raise ValueError(
"The folder listing is incomplete. "
"Retrieve all pages before merging."
)
urls = []
for item in data.get("files", []):
if item.get("mimeType", "").startswith("application/vnd.google-apps."):
url = item.get("exportLinks", {}).get("application/pdf")
else:
url = item.get("webContentLink")
if not url:
raise ValueError(
"No download or PDF export link for: "
+ item.get("name", item["id"])
)
urls.append(url.replace(",", "%2C"))
output = {
"formatted_url": ",".join(urls),
"file_count": len(urls)
}The code uses download links for uploaded files and PDF export links for Google Workspace documents. It preserves the returned file order.
Add Filter by Zapier and continue only when file_count (Number) Is greater than 1.
Step 5: Merge the Files
Add PDF.co → PDF Merger and connect your PDF.co account through the OAuth sign-in window.
Configure:
- Source Files URLs: Map
formatted_urlfrom the Code step. - Automatically Convert Non-PDF Files: Select Yes for mixed document formats, or No for PDFs only.
- Output File Name: Enter
merged-folder.pdf.
Test the action and inspect the returned PDF. See the PDF Merger documentation for supported settings and limits.
Step 6: Save the Merged PDF
Add Google Drive → Upload File.
Select the separate output folder, map PDF.co’s returned url to File, and set Convert to Document? to No, if shown.
Test the upload, check the merged file’s contents and order, then publish your Zap. Each scheduled run creates a new merged copy of the input folder’s current contents.
In conclusion, merging multiple files from a Google Drive folder into a single document is straightforward with PDF.co and Zapier. This tutorial has shown you how to set up and automate the process, enhancing your workflow and saving time. With this efficient solution, document management becomes a breeze. Try it today and see the difference!
Related Tutorials

