← All insights Automation & Workflow Optimization

Build a Free Email Parser with Apps Script & Google Sheets

Still paying for expensive automation tools or manually copying booking data from emails into your spreadsheet? Discover how to use Google Apps Script to automatically read incoming emails, extract key fields, and log them into Google Sheets for free.

email parsing

Ditch Zapier: Build a Free Automatic Email Parser with Google Apps Script and Sheets

How modern e-commerce brands and local services automate manual booking and order processing without the high subscription costs.

Whether you manage a local moving company handling incoming booking forms, a boutique e-commerce shop receiving third-party supplier orders, or a B2B agency capturing leads, your inbox is likely flooded with transactional emails. Paying an employee hours each week just to copy names, dates, and order values into a spreadsheet is an expensive bottleneck.

While many businesses turn to third-party automation tools like Zapier or Make, these platforms quickly become expensive as your transaction volume scales. Fortunately, if you use Google Workspace or a Gmail account, you already have access to a completely free, enterprise-grade alternative: Google Apps Script.


The Cost of Inefficient Processing: Apps Script vs. Zapier

Let's look at why building your own micro-automation tool is a game-changer for growing businesses:

Feature Zapier (Professional Plan) Google Apps Script Alternative
Monthly Cost ~$49 to $299+ USD / month 0.00 € (100% Free)
Task Execution Limits Capped by your pricing tier Generous daily limits (Up to 20,000 emails/day)
Data Control Processes data on third-party servers Kept securely inside your Google Ecosystem
Parsing Logic Visual UI or extra Regex add-on costs Fully flexible JavaScript (RegEx / String manipulation)

The Architecture: How the Auto-Parser Works

The entire automation operates via a lightweight JavaScript environment hosted directly inside your Google Spreadsheet. It follows a simple, robust loop:

  1. Isolate: The script scans your inbox for unread emails containing a specific subject line or label (e.g., "New Booking Request").
  2. Extract: Using regular expressions (RegEx), it pulls specific values from the email body (Client Name, Phone Number, Service Date, Pricing).
  3. Log & Tag: It appends a new row to your Google Sheet with the extracted data and marks the email as read so it won't be processed twice.

Step-by-Step Blueprint: The Code

To implement this, create a new Google Sheet, navigate to Extensions > Apps Script, clear out any default code, and paste the customized script below:

function parseIncomingEmails() {
  // 1. Locate the active spreadsheet tab
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Bookings");
  
  // 2. Search for unread emails matching your search criteria
  var searchQuery = "subject:\"New Booking Request\" is:unread";
  var threads = GmailApp.search(searchQuery);
  
  if (threads.length === 0) {
    Logger.log("No new unread booking emails found.");
    return;
  }
  
  // 3. Loop through matching emails
  for (var i = 0; i < threads.length; i++) {
    var messages = threads[i].getMessages();
    
    for (var j = 0; j < messages.length; j++) {
      var message = messages[j];
      
      // Double check read status to avoid duplicates
      if (message.isUnread()) {
        var body = message.getPlainBody();
        var dateReceived = message.getDate();
        
        // 4. Extract data fields using Regular Expressions (RegEx)
        var nameMatch  = body.match(/Name:\s*(.*)/);
        var phoneMatch = body.match(/Phone:\s*(.*)/);
        var dateMatch  = body.match(/Date:\s*(.*)/);
        
        var clientName  = nameMatch  ? nameMatch[1].trim()  : "N/A";
        var clientPhone = phoneMatch ? phoneMatch[1].trim() : "N/A";
        var bookingDate = dateMatch  ? dateMatch[1].trim()  : "N/A";
        
        // 5. Append data to your Google Sheet rows
        sheet.appendRow([dateReceived, clientName, clientPhone, bookingDate]);
        
        // 6. Mark message as read to complete the processing lifecycle
        message.markRead();
      }
    }
  }
}

Deploying the Automation to Run on Autopilot

Once your code is configured, you don't even need to hit "Run" manually. You can set Google's servers to run this function dynamically behind the scenes:

  1. Inside the Apps Script editor, click on the Triggers icon (the small alarm clock on the left sidebar).
  2. Click + Add Trigger in the bottom right corner.
  3. Under "Choose which function to run", select parseIncomingEmails.
  4. Set the event source to Time-driven.
  5. Select your preferred interval (e.g., Minutes timer running every 5 or 10 minutes).
  6. Save and authorize the necessary Google permissions.

Your automated parser is now live! The system will scan your inbox every few minutes, cleanly capturing transactions or client scheduling options on the fly.

Need an Advanced Custom Software Pipeline?

While Apps Script is a phenomenal tool for standalone Google Workspace automations, larger platforms frequently scale into standalone Microservice architectures leveraging Python frameworks and transactional databases.

If you need specialized engineering to scale up your systems, migrate away from legacy tools, or integrate advanced custom logic, we are here to map out your infrastructure.

Contact us at Tekkowide today for a free architectural consultation!