Get Gmail Emails into Google Sheet Using App Script 2025 (Source Code Provided)
Why Stack Overflow recommends it
Stack Overflow users link it when they need a working Apps Script example for pulling Gmail messages into a spreadsheet, usually as a starting point they then adapt.
Recommended by 2 people across 3 different months, 2019 to 2021.
What it is
A screen-recorded tutorial showing how to write a Google Apps Script that reads Gmail messages under a chosen label and lists their date, subject, sender and raw body in a Google Sheet. The presenter, Moayad Abu Rmilah of Code Wondo, supplies the full source code on GitHub and a blog post, and the video is part of a short series.
What people said
Recommends Moayad Hani Abu Rmilah · 2019-07 · Stack Overflow · on “get gmail email contents and transfer to google spreadsheet and arrange accordingly”
I coded what you want on Google App Script and I have made a YouTube video that explains this in details. You may watch it from the link below: [this video] However if you would like to extract specific texts from the body of the email, you would need to use regular expressions. Part 2 of my video series explains how to achieve this. You may watch it here: [LINK] You may also read the full step-by-step explanation from my blog: [LINK] You can also get the full code from GitHub from the following link: GitHub: Get Gmail Emails into Google Sheet [LINK] GitHub: Extract Body Contents from Gmail Emails [LINK]
Recommends Moayad Hani Abu Rmilah · 2020-02 · Stack Overflow · on “How to read all emails in gmail using google apps script”
After I published a video on how to get Gmail messages into a Google spreadsheet, I received a feedback from some viewers that they could only get a number of messages but others fail to be processed. Therefore, I did some research and found that the process of getting emails may fail and make the system unable to handle the huge amount of emails. This is mentioned in the Gmail API here: [LINK] The documentation suggests to use getThreads(start, max) where start and max are the limiting parameters. You may view the video and download the full code from YouTube and GitHub: [this video]
Recommends Masterkenobi · 2021-09 · Stack Overflow · on “Google Apps Script to extract data from Gmail and fill in matching row in Google Sheets”
I have a Google Sheets that look like this... [LINK] My goal is to get certain email in my Gmail account and extract the data in the email and populate column C with the matching value from Column A. This is the sample email body... New status update for your shipment! Tracking No. JK5SD8F4M6 Items Product A Status At Warehouse 2 Following the tutorial from [this video] , I manage to extract the data and append to a new row in the sheet using this function. function extractDetails(message){ var emailData = { body: "Null", date: "Null", trackingno: "Null", } emailData.date = message.getDate(); emailData.body = message.getPlainBody(); emailData.trackingno = emailData.body.match(/(?<=Tracking No. ).
Cites SeriousTyro · 2021-05 · Stack Overflow · on “Google Sheet Script to Search for Email and Save the Email Thread as PDF to Google Drive and/or Local PC”
From [LINK] and [this video] I would be able to search an email thread and save it's metadata to a spreadsheet. However, I am not sure how to save that email thread as a pdf to google drive or local PC. The pdf contents would be as if you were printing an email thread as a PDF. Is this outside the scope of google sheet scripting? Any guidance would be much appreciated. Code from [this video] var ui = SpreadsheetApp.getUi(); function onOpen(e){ ui.createMenu("Gmail Manager").addItem("Get Emails by Label", "getGmailEmails").addToUi(); } function getGmailEmails(){ var input = ui.prompt('Label Name', 'Enter the label name that is assigned to your emails:', Browser.Buttons.OK_CANCEL); if (input.getSelected