Skip to main content
Use this guide to send all files in a Google Drive folder to a Parabola flow. This is useful for creating historical data tables from files that have accumulated in a shared folder.

Prerequisites

  • A Parabola flow with an Extract from email step configured (you’ll need the generated inbound email address)
  • A Google Drive folder containing the files you want to send

Step-by-step setup

1

Create a new Apps Script project

Go to script.google.com and create a new project.
2

Paste the script

Replace the default code with the following script:
function emailFilesInFolder() {
  const RECIPIENT = "[Email Address]"; // Parabola inbound email address
  const FOLDER_ID = "[Folder ID]";    // From the folder's URL

  const folder = DriveApp.getFolderById(FOLDER_ID);
  const files = folder.getFiles();

  while (files.hasNext()) {
    const file = files.next();
    const fileName = file.getName();
    const fileId = file.getId();
    const mimeType = file.getMimeType();

    // Convert Google Workspace files to a compatible format for attachment
    let blob;
    try {
      if (mimeType === MimeType.GOOGLE_DOCS) {
        blob = DriveApp.getFileById(fileId).getAs(MimeType.PDF);
      } else if (mimeType === MimeType.GOOGLE_SHEETS) {
        blob = DriveApp.getFileById(fileId).getAs(MimeType.MICROSOFT_EXCEL);
      } else if (mimeType === MimeType.GOOGLE_SLIDES) {
        blob = DriveApp.getFileById(fileId).getAs(MimeType.MICROSOFT_POWERPOINT);
      } else {
        blob = file.getBlob();
      }

      GmailApp.sendEmail(
        RECIPIENT,
        `File: ${fileName}`,           // Email subject
        `Please find attached: ${fileName}`, // Email body
        { attachments: [blob], name: "Google Drive Bot" }
      );

      console.log(`Sent: ${fileName}`);

    } catch (e) {
      console.log(`Failed to send ${fileName}: ${e.message}`);
    }
  }
}
3

Replace the folder ID

Open your Google Drive folder and copy the ID from the URL — it’s the string of characters after folders/ in the address bar.
Google Drive folder ID in URL
Replace [Folder ID] on line 3 of the script with your folder ID.
4

Replace the email address

Replace [Email Address] on line 2 with the inbound email address from your Parabola flow’s Extract from email step.
5

Run the script

Click the Run button on emailFilesInFolder. You’ll be prompted to authorize permissions on the first run — click through to approve.The script will email each file in the folder to your Parabola flow one at a time.

Things to know

  • Google Workspace files — Google Docs are converted to PDF, Sheets to Excel, and Slides to PowerPoint before sending. Standard file types (CSV, PDF, XLSX, etc.) are sent as-is.
  • Gmail attachment limit — Gmail has a 25 MB attachment limit per email. Files larger than this will fail to send.
  • One-time batch — This script sends all files currently in the folder. It does not watch for new files. If you need ongoing monitoring, see How to watch for new files in Google Drive and send them to Parabola.
Last modified on April 9, 2026