How to Extract Data from Gmail to Google Sheets (With or Without Code)
Last updated August 2026
Try it now: extract email data to Excel, CSV, or JSON
Connect a mailbox to pull .eml/.msg in bulk, or paste a raw email to test the converter now.
Create a free account to download. No credit card required.
Getting data out of Gmail and into Google Sheets is one of those tasks that sounds trivial and turns into a research project. The values you want, an order number, a total, a date, a customer name, are sitting right there in the message. Sheets just has no built-in way to reach into your inbox and grab them. You have two real options: write a Google Apps Script that reads Gmail and appends rows, or use a parser that pulls named fields and hands you a file to import. This guide covers both honestly, with the actual code, so you can pick the one that fits. If your destination is not a spreadsheet at all, the broader guide to extracting data from Gmail covers sending the same fields to a CRM, database, or webhook.
Skip the script
If you just need the data in a spreadsheet without writing Apps Script, connect Gmail or paste an email, name the fields you want, and export a CSV or Excel file ready to import into Google Sheets.
Try the no-code way →How do I extract data from Gmail to Google Sheets?
There are three common ways to extract data from Gmail to Google Sheets: write a Google Apps Script that searches your mail and appends rows, install a Gmail add-on that exports a whole label to a sheet, or use a dedicated parser that pulls named fields and gives you a file to import. The script is free but needs code and upkeep, the add-on copies entire messages rather than specific values, and the parser is the fastest route to clean columns.
Which one fits depends on how much the layout of your emails changes and whether the data is in the body or an attachment. For a single, stable format and a bit of coding comfort, Apps Script is fine. For varied senders, tables, or attachment data, a parser saves the maintenance. Below is each method in detail.
How do I use Google Apps Script to read Gmail into Sheets?
Google Apps Script can read Gmail and write to a sheet because it ships with a GmailApp service and a SpreadsheetApp service. You search for the messages you want, loop through them, read the body, pull out the values you need, and append a row. Open your sheet, choose Extensions then Apps Script, and paste a function like this:
function gmailToSheet() {
var threads = GmailApp.search('label:orders newer_than:7d');
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
for (var i = 0; i < threads.length; i++) {
var messages = threads[i].getMessages();
for (var j = 0; j < messages.length; j++) {
var msg = messages[j];
var body = msg.getPlainBody();
var orderMatch = body.match(/Order number:\s*(\w+)/);
var totalMatch = body.match(/Total:\s*\$?([\d.,]+)/);
sheet.appendRow([
msg.getDate(),
msg.getFrom(),
orderMatch ? orderMatch[1] : '',
totalMatch ? totalMatch[1] : ''
]);
}
}
}
Run it once, approve the Gmail and Sheets permissions when prompted, and the matching rows appear in your sheet. The GmailApp.search() call takes the same operators you use in the Gmail search box, so label:orders newer_than:7d grabs last week's labeled mail. The regular expressions are where you decide which values to capture, and they are also where the fragility lives: the pattern Order number:\s*(\w+) only works while the email keeps saying "Order number:" right before the value.
Can Google Sheets pull data from Gmail automatically?
Yes, but not by itself. Google Sheets has no function that reads your inbox, so the automatic part comes from a time-driven trigger on the Apps Script above. In the Apps Script editor, open Triggers (the clock icon), add a trigger, choose your function, pick "Time-driven," and set it to run every hour or every day. From then on the script checks Gmail on that schedule and appends any new matching rows without you opening it.
The trade-off is that the trigger runs your parsing logic on autopilot, including its mistakes. If a sender changes "Order number" to "Order #" next month, the regex quietly returns blank and the trigger keeps writing empty cells every hour until someone notices. Automation makes a working script effortless and a brittle script invisible, so the more formats you handle, the more carefully you have to watch it.
How do I import emails into Google Sheets without code?
To import emails into Google Sheets without code, use a parser to turn the email into a file, then use File then Import in Sheets. With MailParse you connect Gmail or paste a message, name the fields you want such as order_number, total, and ship_date, and download a CSV or .xlsx. In Google Sheets, choose File, then Import, upload the file, and the data lands in clean columns. No Apps Script, no regular expressions, no permissions to approve.
For an ongoing feed rather than a one-off import, point the parser's JSON output at a no-code automation tool like Zapier or Make and have it append each parsed email as a new row in your sheet. That gives you the same hands-free result as a time-driven trigger, except the field logic is a form you filled in rather than code you maintain. The full setup for how to connect an email parser to Gmail and Google Sheets is covered there.
How do I get Gmail attachments into Google Sheets?
Apps Script can save a Gmail attachment to Drive with msg.getAttachments(), but reading the data inside a PDF or spreadsheet attachment is a separate problem the GmailApp service does not solve. You would need an OCR or document-parsing library on top, which is a real project. That is a common wall: the email body says "invoice attached" and every number you want is locked in the PDF.
A parser handles the message body and any HTML table in one pass. MailParse reads the fields you name from the body and HTML tables and lists each attachment by filename. When the invoice number is locked inside an attached PDF, run that file through a document extraction tool and merge the result, so the value lands in the same row as the sender and date. If your inbox carries the real data in attachments, that routing usually decides the method for you.
Apps Script vs a parser: which is better for Gmail to Sheets?
Apps Script is the better fit when you are comfortable with JavaScript, the emails follow one steady format, the data is in the body, and you do not mind maintaining the regular expressions when a template changes. It is free, it lives inside your own Google account, and it is flexible enough to do nearly anything if you put in the time.
A parser is the better fit when you have many senders or layouts that drift, when the data sits in HTML tables or attachments, or when the numbers simply have to be right every time without someone babysitting a script. You trade a small subscription for naming fields on a form instead of writing and patching code. Many teams start with Apps Script and switch the first time a vendor changes a template and a week of rows comes out blank.
If you want to see the no-code path in action, you can parse an email right now and watch the columns appear, set up an ongoing Gmail to Google Sheets feed, or read our comparison of four ways to export emails to Excel for the wider picture. If your spreadsheet lives in Excel rather than Sheets, the same steps are laid out in the guide on how to extract data from Gmail to Excel. Teams whose records live in a database rather than a sheet can send the same parsed fields to a Notion database or an Airtable base instead. Developers who want the output in JSON can do the same extraction through the email parser API.