class GmailApp method .createLabel()

GmailApp is the Apps Script service.

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

What it does

Creates a new Gmail label.

Why it's used

  • Set up a new label the first time a workflow runs.
  • Organize automated mail without touching Gmail settings by hand.

Common errors

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

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.createLabel().

Browse the blog