class GmailApp method .getThreadById()

GmailApp is the Apps Script service.

.getThreadById() is the method name you will see after a dot in your code.

What it does

Loads an email thread by its ID.

Why it's used

  • Reopen a whole conversation when a ticket ID points to it.
  • Apply a label or archive an entire thread at once.

Common errors

  • Forgetting parentheses on getThreadById. Write GmailApp.getThreadById(), not GmailApp.getThreadById or getThreadById by itself.
  • Skipping dots between chained calls. Each step needs a dot, like GmailApp.search('label:inbox').getThreadById().
  • Adding spaces where they do not belong. Write GmailApp.getThreadById(), not GmailApp .getThreadById(), GmailApp.getThreadById (), or GmailApp . getThreadById().
  • Wrong capitalization. Use GmailApp and getThreadById, not gmailapp or getthreadbyid.

Explore

Related methods

Better Sheets tutorials

No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.

Related blog posts

Written guides about GmailApp.getThreadById().

Browse the blog