Create an Unsubscribe Feature for Personal or Gmail Emails (Google Sheet Auto-Recording System)
Ever wondered if you can add an “Unsubscribe” link to emails sent from your personal Gmail or business account?
The answer is YES — you can build one easily using Google Sheets + Apps Script for free.
By following the steps below, every time a recipient clicks “Unsubscribe,” their email will be automatically recorded in a Google Sheet.
Overview
This simple system saves the recipient’s email to a Google Sheet when they click the Unsubscribe link,
so you can exclude them from future mailings.
Workflow:
[Email] → [Unsubscribe link click] → [Form page] → [Google Apps Script] → [Google Sheet record]
Step 1. Set up your Google Sheet
1. Create a new Google Spreadsheet.
2. Rename the sheet tab to UnsubscribeList.
3. In the first row, add the following headers:
Timestamp Email Status
Make sure the name matches exactly, as the Apps Script will call it using:
getSheetByName('UnsubscribeList').
Step 2. Write the Google Apps Script
In your Sheet, go to Extensions → Apps Script and paste the following code:
function doPost(e) {
const ss = SpreadsheetApp.openById('YOUR_SPREADSHEET_ID');
const sheet = ss.getSheetByName('UnsubscribeList');
const email = e.parameter.email;
const confirm = e.parameter.confirm;
if (confirm && email) {
sheet.appendRow([new Date(), email, "Unsubscribed"]);
}
return ContentService.createTextOutput("Thank you! You have been unsubscribed.");
}
Replace YOUR_SPREADSHEET_ID with your actual Sheet ID (found between /d/ and /edit in the URL).
Step 3. Deploy as a Web App
Click Deploy → New deployment and choose:
- Type: Web app
- Execute as: Me
- Who has access: Anyone
Click Deploy, approve permissions, and copy the Web App URL — for example:
https://script.google.com/macros/s/AKfycbyo12345/exec
This URL will be the form’s action value in the next step.
Step 4. Create the Unsubscribe Form Page
<h2>Unsubscribe</h2>
<p>We’re sorry to see you go. Please confirm below:</p>
<form method="POST" action="https://script.google.com/macros/s/AKfycbyo12345/exec">
<label>
<input type="checkbox" name="confirm" value="true" required>
I no longer wish to receive promotional emails.
</label><br><br>
<input type="hidden" name="email" id="email" value="">
<button type="submit">Submit</button>
</form>
<script>
const params = new URLSearchParams(window.location.search);
const email = params.get('email');
if (email) document.getElementById('email').value = email;
</script>
You can host this page on WordPress, Webflow, or a simple HTML site.
Just update the action URL to your own Web App link.
Step 5. Add the Unsubscribe Link to Your Email
<p style="font-size:13px;color:#777;">
If you no longer wish to receive emails, please
<a href="https://yourdomain.com/unsubscribe?email=john@example.com" target="_blank">unsubscribe</a>.
</p>
Replace john@example.com with the actual recipient’s email address dynamically in your message.
When the user clicks the link, their email will automatically populate the form and be logged in Google Sheets.
Step 6. Test Your Setup
- Send a test email to yourself.
- Click the Unsubscribe link → check the form → submit.
- Refresh your Google Sheet and confirm a new row appears.
Timestamp Email Status 2025-10-24 john@example.com Unsubscribed
Optional: Automation Tips
- Using Contact Form 7? Apply the same JavaScript to a hidden email field.
- Integrate with Flamingo to store entries in WordPress DB.
- Use
{{ contact.EMAIL }}in Brevo or Mailchimp to automate email variables.
Conclusion
You now have a fully functional Unsubscribe + Auto Record System — even for emails sent manually via Gmail.
Simple, effective, and compliant with CAN-SPAM regulations.
Process Summary:
Click → Form Submit → Google Sheet Log → Exclude from Next Campaign
Keep your subscriber management clean, prevent spam complaints, and maintain professional communication easily with this setup.
