How to create Gmail labels with GAS (GoogleAppsScript).
GmailApp.createLabel(label name)
You can create a label by using ‘GmailApp.createLabel(name)’.
GmailApp.createLabel('テストラベル');
Just by executing this, the label name of the argument is newly created.
Create a function that creates labels
Create a function that creates labels.
function CreateNewLabel(){
GmailApp.createLabel('テストラベル');
}
I’ll try it.
At the time of execution, as usual, a confirmation screen for granting permission to execute will appear, so proceed.
It seems that you need permission to Gmail this time, so give permission.
Once I did that, a new label was created!
summary
A new label is created by using ” createLabel(label name) “.
By looping the label names, it can be applied to create all at once! I would like to apply it in various ways.
Please refer to it.