> ## Documentation Index
> Fetch the complete documentation index at: https://parabola.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# How to send all files in a Google Drive folder to a Parabola flow

> Use a Google Apps Script to email every file in a Google Drive folder to a Parabola flow via the Extract from email step — useful for building historical data tables.

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

<Steps>
  <Step title="Create a new Apps Script project">
    Go to [script.google.com](https://script.google.com) and create a new project.
  </Step>

  <Step title="Paste the script">
    Replace the default code with the following script:

    ```javascript theme={null}
    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}`);
        }
      }
    }
    ```
  </Step>

  <Step title="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.

    <Frame>
      <img src="https://mintcdn.com/parabola-7119dfb0/qrK2PkO0x6sZL81B/images/google-drive-folder-id.png?fit=max&auto=format&n=qrK2PkO0x6sZL81B&q=85&s=ebea21e8765569f5d6d3f639ef2d4ba2" alt="Google Drive folder ID in URL" width="353" height="33" data-path="images/google-drive-folder-id.png" />
    </Frame>

    Replace `[Folder ID]` on line 3 of the script with your folder ID.
  </Step>

  <Step title="Replace the email address">
    Replace `[Email Address]` on line 2 with the inbound email address from your Parabola flow's **Extract from email** step.
  </Step>

  <Step title="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.
  </Step>
</Steps>

## 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](/articles/how-to-watch-for-new-files-in-google-drive-and-send-them-to-parabola).
