Ask Steves · Daily notes · VPS, 20% off · AI Profit Lab · SEO · Money Hub

29 October 2026 · Practical AI builds

How do I file form enquiries into a spreadsheet automatically?

By the end of this you will have a spreadsheet that fills itself. Each enquiry email from your website form lands as a new row with the date, name, email, phone and message, and you never copy and paste again. It suits anyone whose form sends enquiries to a Gmail or Google Workspace inbox and who would rather keep track of leads in a sheet than in a busy inbox.

I learn my automation tips in the AI Profit Boardroom. Have a look here. Affiliate link.

What you need

Step by step

  1. Open one enquiry email and note exactly how the fields are labelled, for example Name:, Email:, Phone: and Message:. The script relies on these labels.
  2. In Gmail, create two labels: enquiries and enquiries-filed.
  3. Make a Gmail filter that matches your form emails (by the sender address or a subject such as "New enquiry") and applies the enquiries label. Tick the option to apply it to matching emails you already have if you want to backfill.
  4. Create a Google Sheet, rename the first tab to Enquiries, and type headings in row 1: Date, Name, Email, Phone, Message, Message ID.
  5. In the sheet, open Extensions, then Apps Script, delete the sample code and paste the script below. Change the field labels if yours differ.
  6. Press Run once. Google will ask you to allow the script to read your Gmail and edit the sheet. Read the request, then allow it.
  7. Check the sheet. Any labelled emails should now be rows, and in Gmail they should have moved from enquiries to enquiries-filed.
  8. In Apps Script, open Triggers (the clock icon), add a trigger for fileEnquiries, choose "Time-driven" and pick every 15 minutes or every hour.
function fileEnquiries() {
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Enquiries');
  const todo = GmailApp.getUserLabelByName('enquiries');
  const done = GmailApp.getUserLabelByName('enquiries-filed');
  const threads = todo.getThreads(0, 50);

  threads.forEach(thread => {
    thread.getMessages().forEach(msg => {
      const body = msg.getPlainBody();
      const field = name => {
        const m = body.match(new RegExp('^' + name + ':\\s*(.*)$', 'mi'));
        return m ? m[1].trim() : '';
      };
      sheet.appendRow([
        msg.getDate(),
        field('Name'),
        field('Email'),
        field('Phone'),
        field('Message'),
        msg.getId()
      ]);
    });
    thread.addLabel(done);
    thread.removeLabel(todo);
  });
}

The script only looks at emails carrying the enquiries label, files them, then swaps the label so the same email is never filed twice. The Message ID column lets you find the original email later if you need to.

What good looks like

Send a test enquiry through your own website form. Within one trigger interval a new row should appear with every column filled in, and the email in Gmail should show the enquiries-filed label. If a column comes out blank, the label in the email does not quite match the one in the script (check spelling, capitals and the colon). If nothing happens at all, open Executions in Apps Script to see the error.

Watch out for

Questions people ask

Does this work if my enquiries go to Outlook instead of Gmail?

Not as written, because Apps Script reads Gmail. You can forward form emails to a Gmail address and use the same steps, or use an automation tool that connects to Outlook and to a spreadsheet, though those often need a paid plan for regular use.

Is there a limit on how many enquiries it can handle?

Google sets daily limits on how much a script can read from Gmail, and the limits depend on your account type, but a small business inbox is very unlikely to reach them. The script files up to 50 threads per run, and anything left over is picked up on the next run.

That is the whole build: a Gmail filter labels each enquiry, a short script copies the fields into a sheet on a timer, and a second label stops anything being filed twice.

Want more automation tips? The AI Profit Boardroom on Skool is where I get mine. Have a look here. Affiliate link.

Related AI builds: How do I get a daily summary email of what happened on my website? · How do I connect a website form to an AI that drafts the first reply? · How do I get a phone alert when a form on my site is filled in? · All daily notes