🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

How can we help you?

Find answers, tutorials, and guides to get the most out of Gravity Extra add-ons. (DEV Preview)

Gravity Forms + Google Drive Integration Documentation & Setup Guide

Last updated: September 16, 2026 • Author: Bong Huynh
Table of Contents

Video walkthrough

Send Gravity Forms File Uploads to Google Drive (Folder per Entry, No Zapier)
Send Gravity Forms file uploads to Google Drive with the GravityExtra add-on Watch on YouTube

The Gravity Forms Google Drive Integration Add-on connects your WordPress forms directly to Google Drive via the official Google Drive REST API v3. When a user submits an entry, file uploads, generated PDF contracts, and Word documents are streamed directly to your designated Google Drive folders in real time—eliminating local server disk storage bottlenecks and bypassing recurring monthly middleware subscription fees.

System Requirements & Prerequisites

  • WordPress: Version 5.8 or higher
  • Gravity Forms: Version 2.5 or higher (Pro, Elite, or Basic)
  • PHP: Version 7.4, 8.0, 8.1, 8.2, or 8.3
  • Google Account: A standard Google account or Google Workspace account with access to the Google Cloud Console
  • Add-on License: Active Gravity Forms Google Drive Integration license key

Google Cloud Console OAuth 2.0 Configuration

To securely authenticate your WordPress site with Google Drive without storing master account passwords, this add-on uses Google’s standard OAuth 2.0 protocol. Follow these steps to generate your private Client ID and Client Secret in the Google Cloud Console.

Step 1: Create a New Google Cloud Project

Sign in to the Google Cloud Console. Click the project dropdown at the top navigation bar and select New Project.

Google Cloud Console Select Project
Opening the project selector dialog from the top navigation bar in Google Cloud Console.

Click the NEW PROJECT button in the top-right corner of the modal dialog.

Click New Project button
Initiating a new project within your Google Cloud organization or personal account.

Enter a recognizable Project Name (such as Gravity Forms Drive Integration) and select your Organization if applicable. Then click Create.

Name your project
Naming the Google Cloud project and clicking Create.

Select the newly created project from the notifications menu or the top project picker to make it active.

Select active project
Switching to the newly created project in Google Cloud Console.

Step 2: Enable the Google Drive API

In the left sidebar, navigate to APIs & Services > Library. Click on ENABLE APIS AND SERVICES.

Enable APIs and Services
Navigating to the API Library from the APIs & Services dashboard.

Search for Google Drive API in the search bar and select it from the results.

Search Google Drive API
Searching for Google Drive API in the Google Cloud API Library.

Click the blue ENABLE button to activate the Google Drive API for this project.

Enable Google Drive API
Enabling the Google Drive REST API.

Step 3: Configure the OAuth Consent Screen & Publish App

From the left sidebar, navigate to APIs & Services > OAuth consent screen. Select External user type (or Internal if using Google Workspace within an organization), then click Create.

OAuth Consent Screen User Type
Selecting the OAuth user type.

Fill in the basic app details: App name (e.g., Gravity Forms Uploader), User support email, and Developer contact information. Click Save and Continue through the scopes step and return to the dashboard.

App details input
Providing app identification and contact emails.
OAuth consent screen summary
Reviewing OAuth consent screen configuration.

Critical Step: Publish Your App
Under Publishing status on the OAuth consent screen tab, click the PUBLISH APP button and confirm. If your app remains in “Testing” status, Google automatically expires your OAuth refresh tokens every 7 days, forcing re-authentication every week. Publishing the app ensures permanent, uninterrupted connectivity.

Publish App in OAuth consent screen
Publishing the OAuth application to keep refresh tokens permanently active.

Step 4: Create OAuth 2.0 Credentials

In the left sidebar, click on Credentials. Then click CREATE CREDENTIALS > OAuth client ID.

Create OAuth client ID
Creating new OAuth client ID credentials.

Select Web application from the Application type dropdown. Enter a descriptive name like Gravity Forms Web Client.

Select Web application type
Selecting Web application as the OAuth client type.

Scroll down to Authorized redirect URIs and click ADD URI. Copy the exact Redirect URI displayed in your WordPress admin under Forms > Settings > Google Drive and paste it here. Then click CREATE.

Add Authorized redirect URI
Entering the Authorized redirect URI generated by your WordPress site.

A modal will appear displaying your new Client ID and Client Secret. Copy both values.

Copy Client ID and Client Secret
Saving the generated Client ID and Client Secret.

Step 5: Connect WordPress to Google Drive

Navigate to Forms > Settings > Google Drive in your WordPress admin dashboard. Paste your App Key (Client ID) and App Secret into the respective fields, then click Click here to connect to Google Drive.

Paste credentials in WordPress settings
Pasting credentials and initiating the OAuth 2.0 authorization handshake.

Choose your Google account in the OAuth consent popup window.

Select Google account
Selecting the destination Google Drive account.

Grant the required permissions to allow Gravity Forms to manage files in your Drive, then click Continue.

Grant Drive permissions
Allowing file management scopes on Google Drive.
Google Drive connected successfully
Successful Google Drive connection status confirmation.

Destination Folder Depth & Hierarchy

To prevent slow API lookups on accounts with thousands of folders, the add-on includes a configurable Folder Depth Level setting (up to 3 levels). This defines how deep the folder selection dropdown scans your Drive structure.

Select Level Folder setting
Configuring the folder hierarchy level scanning depth in form settings.

Depending on your selection (Level 1, Level 2, or Level 3), you can target sub-folders nested inside parent directories with full breadcrumb path visibility.

Level 1 Folder depth
Level 1 scans top-level root folders.
Level 2 Folder depth
Level 2 scans primary sub-folders within root directories.
Level 3 Folder depth
Level 3 allows deep nesting for organized departmental file routing.

Configuring Form Uploads & Dynamic Sub-Folders

Add a standard File Upload field to your Gravity Forms layout. The add-on supports single file uploads, multi-file uploads, and all standard file extensions allowed by WordPress.

Gravity Forms File Upload field
Dragging the File Upload field into the Gravity Forms editor.

Next, go to Settings > Google Drive inside your form editor to configure upload behavior and dynamic sub-folder organization.

Form Google Drive Settings
Form-specific Google Drive configuration panel.
  • Google Drive Enabled: Toggle to activate Drive synchronization for this form.
  • Enable Sub Folder: Automatically creates a dedicated sub-folder for every entry submission inside the parent destination folder.
  • Sub-Folder Naming Rule: Use Gravity Forms merge tags (such as {Name (First):1.3}_{Name (Last):1.6}_{entry_id} or {date_mdy}) to dynamically name each folder.
  • File Upload Field: Select “All File Upload Fields” or restrict uploads to a specific file field.
  • Destination Folder: Choose your target Google Drive folder from the real-time folder tree.

Local Server File Retention (Storage Management)

By default, web hosting servers have limited disk storage and strict inode quotas. Accumulating heavy files (videos, high-resolution photography, raw PDFs) inside your WordPress wp-content/uploads/ directory can cause severe backup slowdowns, expensive storage tier upgrades, or hosting crashes.

How the Local File Retention Toggle Works

Under Form Settings > Google Drive, find the Local File Retention toggle:

  • Toggle Disabled (Default – Auto-Purge): Files are uploaded directly to Google Drive, and the local copy on your WordPress server is immediately deleted upon confirmed upload. Your web server retains 0 MB overhead.
  • Toggle Enabled (Keep Local Copy): Files are uploaded to Google Drive AND a duplicate copy remains stored securely in your WordPress media upload directory as an offline backup.

Dynamic Custom File Renaming with Merge Tags

When users submit forms, their raw file names are often messy or ambiguous (e.g. scan12.pdf, IMG_5839.PNG, resume.docx). The add-on includes a powerful dynamic renaming engine that standardizes all incoming files before they land in Google Drive.

Enable the Enable Custom File Name checkbox in your form feed settings, and input your desired naming pattern in the Custom File Name field.

Recommended Renaming Patterns
// Format by Form, Entry ID & Original Name:
{form_title}-{entry_id}-{original_filename}
// Format by Submitter Name & Date:
{Name (Last):1.6}_{Name (First):1.3}_{date_mdy}-{original_filename}
// Format for Invoices or Account IDs:
Invoice_{entry_id}_{Company:3}-{original_filename}

Special Modifier {original_filename}: This tag extracts the user's original uploaded file name without its extension. The add-on automatically preserves the proper file extension (e.g. .pdf, .jpg, .docx) at the end of the generated string, preventing accidental double extensions like file.pdf.pdf.

File Access Permissions & Notification Merge Tags

By default, files uploaded via Google Drive API inherit permissions from the parent folder. The add-on allows you to override and specify strict granular file access rules directly upon upload.

  • Anyone with the link: Grants read-only (viewer) access to anyone who possesses the file URL. Perfect for public application downloads, marketing assets, or open contest submissions.
  • Restricted: Restricts file visibility strictly to designated team members. Enter one or more comma-separated email addresses (e.g. hr@company.com, legal@company.com). Only authenticated Google accounts matching those emails will be able to open the file.

Embedding Google Drive Links in Confirmations & Emails

You can include direct links to uploaded Google Drive files inside Gravity Forms Confirmation Messages and Email Notifications using these dedicated merge tags:

  • {googledrive:file_urls} — Outputs raw, plain-text Google Drive URLs separated by newlines. Ideal for webhook payloads or plain-text email alerts.
  • {googledrive:file_urls_rich_text} — Outputs fully formatted, clickable HTML anchor tags with original file names (e.g. <a href="..." target="_blank">filename.pdf</a>). Ideal for HTML confirmation pages and rich email notifications to clients.

Automatic GravityPDF & MS Word Ingestion

Beyond standard user uploads, the add-on integrates seamlessly with GravityPDF and the Gravity Forms MS Word Premium Add-on. Dynamically generated invoices, certificates, and contract files are automatically captured and uploaded to your Drive folder upon form submission.

To sync generated PDF documents, open Settings > PDF in your form editor and click Add New.

GravityPDF Settings in form
Accessing GravityPDF settings within the form.
Add new PDF feed
Creating a new PDF generation template feed.

Configure your PDF template name, filename pattern, and appearance, then click Add PDF.

Save PDF Template
Saving the PDF generation template.

Return to Settings > Google Drive. In the File Upload Field selector, your generated PDF document is now available alongside standard file fields.

Select generated PDF in Drive settings
Selecting the generated PDF template for automatic Drive upload.
Select PDF option
Designating the generated PDF as an active upload source.

Developer Hooks & Filter Reference

Customize file naming schemes, dynamic folder routing, and post-upload automation with these extensible PHP hooks.

Filter: Customize Dynamic Sub-Folder Name

Override the sub-folder naming formula programmatically before directory creation:




functions.php
PHP

// Dynamically prepend entry ID and sanitize folder name
add_filter( 'gform_google_drive_folder_name', function( $folder_name, $form, $entry ) {
    if ( $form['id'] == 5 ) {
        return 'Client_' . $entry['id'] . '_' . sanitize_file_name( $folder_name );
    }
    return $folder_name;
}, 10, 3 );

Action: Post-Upload Drive Webhook & File Logging

Execute actions immediately after a file is successfully uploaded to Google Drive:




functions.php
PHP

// Log Google Drive File ID and direct link in entry meta
add_action( 'gform_google_drive_post_upload', function( $file_id, $file_url, $entry, $form ) {
    gform_update_meta( $entry['id'], 'drive_file_id', $file_id );
    gform_update_meta( $entry['id'], 'drive_view_url', $file_url );
}, 10, 4 );

Troubleshooting & Frequently Asked Questions

Why do I receive an “Error 400: redirect_uri_mismatch”?

This error occurs when the Authorized Redirect URI in your Google Cloud Console does not match the exact URL generated by your WordPress site. Ensure you have copied the URI character-for-character from Forms > Settings > Google Drive, including protocol (https://) and trailing slashes.

Why does my Google Drive connection expire after 7 days?

In Google Cloud Console, projects with OAuth consent screens set to “Testing” status have their refresh tokens revoked after 7 days by Google security policy. Navigate to APIs & Services > OAuth consent screen and click PUBLISH APP to make the connection permanent.

Are Google Workspace Shared Drives (Team Drives) supported?

The add-on fully supports personal “My Drive” folders and personal shared folders (folders shared directly with your authorized account). Google Workspace Team Shared Drives requiring domain-wide delegation are not currently supported by standard OAuth authentication.

Do uploaded files take up disk space on my web hosting server?

No. The add-on is designed for zero local storage footprint. Files are streamed directly into your destination Google Drive folder upon entry processing, keeping your web server lean and saving valuable hosting disk space.

Related Resources & Live Demonstration

Was this article helpful?

Let us know how we can improve our docs.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr