This WordPress free plugin helped “Form to Google Sheet” that integrates with Contact Form 7 to send form submissions directly to a Google Sheet, streamlining data collection and management. The plugin is designed for non-coders, with a user-friendly settings page to configure the integration using Google API credentials. It leverages the Google Sheets API to append form submissions as new rows in real-time, supporting Contact Form 7’s fields and including error logging for reliability. The plugin is lightweight, secure, and includes an admin page with setup instructions.
📥 My Awesome Plugin
This plugin helps you automate tasks and improve web performance.
⬇️ Download Plugin ZIP💌 Subscribe to Updates
EMAIL & FORM AUTOMATION free Plugin
Note: You’ll need a Google Cloud project with the Google Sheets API enabled and OAuth 2.0 credentials (Client ID and Client Secret). This plugin works specifically with Contact Form 7, a popular free form plugin with over 10 million active installations.
Installation and Setup Instructions
- Install Contact Form 7:
- In your WordPress admin dashboard, go to Plugins > Add New.
- Search for Contact Form 7, install, and activate it.
- Download the Plugin:
- Copy the PHP code above into a file named wp-form-to-google-sheet.php.
- Place this file in a folder named wp-form-to-google-sheet.
- Upload to WordPress:
- Zip the wp-form-to-google-sheet folder.
- In the WordPress admin dashboard, go to Plugins > Add New > Upload Plugin.
- Upload the zipped folder and click Install Now.
- Activate the Plugin:
- After installation, click Activate Plugin.
- Set Up Google Cloud Project:
- Go to console.cloud.google.com and create a new project.
- In the API Library, search for Google Sheets API and enable it.
- Go to Credentials > Create Credentials > OAuth 2.0 Client IDs.
- Set the Authorized Redirect URI to: YOUR_SITE_URL/wp-admin/admin.php?page=ftgs-settings (replace YOUR_SITE_URL with your site’s URL).
- Copy the Client ID and Client Secret.
- Configure Plugin Settings:
- In the WordPress admin dashboard, go to the new menu item Form to Sheet.
- Enter the Google Client ID and Client Secret.
- Create a Google Sheet and copy its Spreadsheet ID from the URL (e.g., https://docs.google.com/spreadsheets/d/[Spreadsheet-ID]/).
- Enter the Spreadsheet ID and Worksheet Name (default: Sheet1).
- Click Save Changes.
- Click Authorize with Google, log in to your Google account, and grant permissions.
- Test the Integration:
- Create or edit a Contact Form 7 form (in Contact > Add New or Edit).
- Submit a test form via your site’s front-end.
- Check the specified Google Sheet to confirm the submission appears as a new row.
- Verify that form fields are mapped to columns, with a timestamp added.
Features
- Real-Time Sync: Sends Contact Form 7 submissions to a Google Sheet instantly as new rows.
- Automatic Headers: Sets column headers based on form fields on the first submission.
- OAuth 2.0 Authentication: Securely connects to Google Sheets using OAuth, with token refresh support.
- Error Logging: Logs issues (e.g., API failures, missing credentials) to the WordPress debug log for troubleshooting.
- Simple Interface: User-friendly settings page for non-coders to configure Google API credentials and sheet details.
- Admin Instructions: Detailed setup guide on the settings page.
- Single File: All functionality is contained in one PHP file.
- Secure: Uses WordPress best practices for API requests, data sanitization, and nonce verification.
How It Works
- The plugin integrates with Contact Form 7’s wpcf7_mail_sent hook to capture form submissions after they’re processed.
- It uses the Google Sheets API to append submissions as new rows in the specified worksheet.
- On first submission, it checks if headers exist in the sheet; if not, it creates them based on form fields plus a timestamp.
- OAuth 2.0 handles authentication, with automatic token refresh to maintain access.
- Errors (e.g., invalid tokens, network issues) are logged to wp-content/debug.log if debugging is enabled (define(‘WP_DEBUG’, true); in wp-config.php).
- The plugin ensures submissions are sent securely and mapped correctly to sheet columns.
Notes
- Dependencies: Requires Contact Form 7 to be installed and activated. A notice will appear if it’s missing.
- Google API Setup: You must create a Google Cloud project and enable the Sheets API. The free tier is sufficient for most users.
- Sheet Structure: Do not delete or reorder columns in the Google Sheet, as this may break the integration. Add new columns manually if needed, but avoid modifying form-generated columns.
- Performance: Sending data to Google Sheets occurs after form submission, with minimal impact on user experience. Ensure your server allows HTTPS requests to sheets.googleapis.com.
- Limitations: The free Google Sheets API has a quota (e.g., 100 requests per 100 seconds per user). For high-volume forms, monitor usage or consider a paid Google Cloud plan.
- Security: OAuth credentials are stored securely in the WordPress database. Revoke authorization via the settings page if needed.
- Compatibility: Works with WordPress 5.0+ and Contact Form 7 5.0+. Test with other form plugins (e.g., CF7 add-ons) for compatibility.
- Backup: Use a WordPress backup plugin (e.g., UpdraftPlus) to safeguard form data in case of sheet issues.
Troubleshooting
- Submissions Not Appearing: Check the Google Sheet for new rows. Enable debugging (define(‘WP_DEBUG’, true); in wp-config.php) and review wp-content/debug.log for errors (e.g., invalid credentials, API quota exceeded).
- Authorization Fails: Ensure the Client ID, Client Secret, and Redirect URI are correct. Re-authorize if needed.
- Columns Misaligned: Verify that the sheet’s headers match the form fields. Avoid manually editing the header row in the sheet.
- API Errors: Check Google Cloud Console for API quota issues or errors. Ensure the Sheets API is enabled.
- Form Not Sending: Confirm Contact Form 7 is active and the form is set up correctly. Test a submission without the integration to isolate issues.
Webloop Integration
Based on your interest in Webloop’s services (e.g., web development, AI tools, automation), this plugin aligns with your goal of streamlining business processes. It can be integrated into Webloop’s ecosystem to automate data collection for clients, such as lead generation or event registrations, syncing directly with Google Sheets for analysis. If you’d like to brand this plugin for Webloop or add features like custom field mapping or integration with Webloop’s AI tools, let me know!
This plugin is ready to use and provides a robust solution for sending Contact Form 7 submissions to Google Sheets. Let me know if you need additional features (e.g., support for other form plugins, multiple sheets, or custom data formatting) or help with setup