WordPress & Contact 7 Forms: Google Sheets Connector and Conditional Fields

A contact form is useful only if the information it collects reaches the people who need it. Email notifications can work for a small website, but they become awkward when several people need to sort inquiries, assign follow-ups, or review what visitors are asking for.
Contact Form 7, a Google Sheets connector, and conditional fields can turn that basic form into a more practical intake workflow. Visitors see questions relevant to their request, while your team receives consistently structured entries in a shared spreadsheet.
This guide is written for a 2019 WordPress setup; plugin features, Google authorization screens, and interface labels may have changed since then.
We’ll build a pet-supplies inquiry form with separate questions for cat and dog owners, then connect it to Google Sheets. The same pattern works for project estimates, service bookings, and sales inquiries.
What Each Plugin Actually Does
Contact Form 7 handles the form itself: field rendering, validation, submission, and email notifications. Google Sheets integration and conditional visibility are not built-in Contact Form 7 features. They require additional plugins or custom development.
For this walkthrough, you need:
- A working WordPress installation with Contact Form 7.
- A compatible Google Sheets connector, such as CF7 Google Sheets Connector.
- Conditional Fields for Contact Form 7, which adds conditional groups and rules.
- A Google account with permission to edit the destination spreadsheet.
- A staging site or a safe page for testing.
Check each extension’s compatibility notes, installation instructions, and available features before installing it. Similar plugin names do not guarantee identical behavior, and some field-mapping or processing options may require a paid edition.
Keep Contact Form 7 email notifications enabled while testing. A successful email does not prove a spreadsheet write succeeded, but it gives you another way to spot missing entries.
1. Plan the Form and Spreadsheet Together
Start with the information your team actually needs. For our example, every inquiry includes a name, email address, pet type, and message. Cat owners also specify a product interest; dog owners specify their dog’s size.
Use one row per submission and one column per field:
| Form field name | Purpose |
| --- | --- |
| your-name | Visitor’s name |
| your-email | Reply address |
| pet-type | Cat or Dog |
| cat-interest | Relevant only to cat inquiries |
| dog-size | Relevant only to dog inquiries |
| your-message | Additional details |
These field names form the contract between WordPress and your spreadsheet. Keep them stable even if you later change the visible labels.
A blank dog-size cell in a cat inquiry is expected, not a data error. Conditional forms produce different subsets of information, so your spreadsheet should accommodate those differences rather than force every cell to contain a value.
2. Build the Contact Form 7 Form
Create a form under Contact → Contact Forms. Give it an administrative name that describes its purpose, then add this markup in the form editor:
<label>Your name
[text* your-name]
</label>
<label>Your email
[email* your-email]
</label>
<label>Type of pet
[select* pet-type include_blank "Cat" "Dog"]
</label>
[group cat-details]
<label>What cat products interest you?
[select* cat-interest include_blank "Food" "Toys" "Grooming"]
</label>
[/group]
[group dog-details]
<label>Dog size
[select* dog-size include_blank "Small" "Medium" "Large"]
</label>
[/group]
<label>How can we help?
[textarea your-message]
</label>
[submit "Send inquiry"]
The asterisk marks a required field. The [group] tags belong to the Conditional Fields extension, not Contact Form 7 itself. Without that extension active, this is not a complete working conditional form.
Configure the email separately
In Contact Form 7’s Mail settings, send notifications to a monitored business inbox. Use an address on your own domain in the From field, and put the visitor’s address in Reply-To:
Reply-To: [your-email]
Include the form’s mail tags in the message body:
Name: [your-name]
Email: [your-email]
Pet: [pet-type]
Cat interest: [cat-interest]
Dog size: [dog-size]
Message: [your-message]
This simple template may show an empty line for the inactive branch. That is acceptable for initial testing. You can refine conditional email formatting afterward using the extension’s documented syntax.
Save the form, then place its generated shortcode on your test page.
3. Add the Conditional Rules
Open the conditional-fields settings associated with the form. Configure two rules:
- Show
cat-detailswhenpet-typeequalsCat. - Show
dog-detailswhenpet-typeequalsDog.
Use the exact option values from the form. Cat and Cats, for example, are different values.
When the initial blank option is selected, neither group should appear. Selecting Cat should reveal only the cat questions; selecting Dog should reveal only the dog questions.
Test required fields inside hidden groups
A supported conditional-fields setup should prevent required fields in an inactive group from blocking submission. Verify that behavior with your installed versions rather than assuming any field hidden by CSS will receive the same treatment.
Also test this sequence:
- Choose Cat and select Toys.
- Switch to Dog and choose Medium.
- Submit the form.
- Inspect both the email and spreadsheet.
Hiding a field does not necessarily erase its value. Some configurations retain previously entered answers, and connector plugins may read submission data differently.
If your extension supports clearing values when a group becomes hidden, evaluate that option. Otherwise, treat pet-type as the authoritative branch indicator and ignore values from inactive branches during downstream processing.
Conditional visibility improves usability; it is not a security boundary. Never use a hidden group to enforce prices, permissions, or other trusted business decisions without server-side validation.
4. Prepare the Google Sheet
Create a spreadsheet and a clearly named worksheet tab, such as Inquiries. The spreadsheet is the whole document; the worksheet is the individual tab inside it. Connector settings may request both.
Add these headings to the first row:
your-name | your-email | pet-type | cat-interest | dog-size | your-message
Enter each heading in a separate cell. The vertical bars above are separators for illustration, not text to paste into one cell.
Many connector configurations match headings to Contact Form 7 field names. Others provide an explicit mapping interface. Follow the installed connector’s instructions, and avoid friendlier headings until you have confirmed that mapping works.
Keep this destination tab simple:
- Do not merge header cells.
- Avoid decorative title rows above the headers.
- Keep formulas and reporting dashboards on another tab initially.
- Restrict editing of headers to people who maintain the integration.
If the connector supports submission dates or other metadata, add those columns using its documented field names. A timestamp column does not populate itself merely because you name it date.
5. Authorize and Configure the Connector
The exact settings depend on the connector release, but the workflow generally follows these steps:
- Open the connector’s Google integration settings in WordPress.
- Start its Google authorization process.
- Sign in with the account that can edit the destination spreadsheet.
- Review the requested permissions and complete the documented authorization flow.
- Open the integration settings for your Contact Form 7 form.
- Identify the destination spreadsheet and worksheet.
- Configure field mappings if the connector requires them, then save.
Some releases ask for names, some for identifiers, and some provide selectors. Do not assume these inputs are interchangeable. If a spreadsheet ID is requested, it is the string between /d/ and /edit in its URL:
https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit
Use an organization-controlled Google account where possible. An integration tied to a departing employee’s personal account is difficult to maintain.
Authorization allows the connector to act within the granted permissions; it does not require making the spreadsheet public. Keep sharing restricted to the people who need access.
6. Verify the Entire Submission Path
Submit test entries through the published page, not just the WordPress editor. Use recognizable test content and check the following cases:
| Test | Expected result | | --- | --- | | Cat inquiry | Correct common fields and cat answer | | Dog inquiry | Correct common fields and dog answer | | Missing active required answer | Validation error; no accepted submission | | Cat changed to Dog before sending | Active branch remains unambiguous | | Punctuation and accented characters | Text preserved correctly | | Long message | Stored without unexpected truncation |
Confirm that each accepted submission produces the expected number of rows and that values land in the correct columns.
Do not describe this as guaranteed real-time synchronization. The integration usually writes around submission time, but Google API errors, revoked authorization, server restrictions, or plugin failures can prevent delivery. Check whether your connector provides logs, retries, or replay tools; do not assume failed writes will recover automatically.
Contact Form 7 does not store submissions by default. If losing an inquiry would be costly, evaluate a compatible local-storage plugin such as Flamingo and apply an appropriate retention policy.
Optional: Check Conditional Data with Apps Script
You do not need Google Apps Script for the connector route. However, it can help inspect the resulting sheet without changing the WordPress integration.
In the 2019 Sheets interface, open Tools → Script editor and run this bound script to find inactive-branch values:
function auditConditionalAnswers() {
var sheet = SpreadsheetApp.getActiveSpreadsheet()
.getSheetByName('Inquiries');
if (!sheet) throw new Error('Inquiries tab not found');
var rows = sheet.getDataRange().getValues();
var headers = rows[0];
var pet = headers.indexOf('pet-type');
var cat = headers.indexOf('cat-interest');
var dog = headers.indexOf('dog-size');
if (pet < 0 || cat < 0 || dog < 0) {
throw new Error('Required headers are missing');
}
for (var i = 1; i < rows.length; i++) {
var row = rows[i];
if ((row[pet] === 'Cat' && row[dog] !== '') ||
(row[pet] === 'Dog' && row[cat] !== '')) {
Logger.log('Review inactive answer in row ' + (i + 1));
}
}
}
This is a manual, read-only audit, not a submission endpoint or backup system. It logs row numbers instead of personal information.
Common Pitfalls and Maintenance
The form succeeds, but no row appears
Check Google authorization, spreadsheet access, worksheet selection, and connector logs first. Then check outbound connectivity from WordPress. The form’s success message is not an end-to-end delivery receipt.
Conditional groups do not respond
Confirm the extension is active and the rules match the group names and option values. Check the browser console for JavaScript errors. Caching, script combination, and theme conflicts can interfere with front-end behavior.
Spreadsheet data becomes unsafe or inconsistent
Treat submissions as untrusted input. Verify how the connector handles values beginning with =, which spreadsheets may interpret as formulas. Where supported, use raw-value insertion or documented text escaping, and test the stored result.
Avoid collecting sensitive information unnecessarily. Publish an appropriate privacy notice, limit spreadsheet access, and define when old submissions should be deleted. A spreadsheet is a convenient collaboration tool, not automatically a suitable repository for every type of personal data.
Takeaway
Build the workflow in layers: a reliable Contact Form 7 form, tested conditional groups, stable spreadsheet columns, and an authorized connector. Then verify actual submissions, including branch changes and failures. The result is a shorter, more relevant form for visitors and a clearer intake queue for your team.
Conversation (0)
No comments yet. Start the conversation.
Join the conversation
Create a free member account to comment.