Today I will present briefly Class GmailThread.
It can be used to retrieve data from incoming electronic mail received by Gmail.
Let’s see a simple example.
First, open a spreadsheet, and from Tools open the Script editor to run this source code:
1 2 3 4 5 6 7 | function getGmailData() { var sheet = SpreadsheetApp.getActiveSheet(); var threads = GmailApp.search("is:unread in:inbox", 0, 7); for (var t=0; t<threads.length; t++) { sheet.appendRow([threads[t], threads[t].getId(), threads[t].getLabels(),threads[t].getFirstMessageSubject()]) } } |
.
Add and run with authorization for Gmail A.P.I. and you will see details from 7 threads emails .