Google Apps Script API
    Preparing search index...

    CardService provides the ability to create generic cards used across different Google extensibility products, such as Gmail add-ons.

    Currently you can only use this service to construct Gmail add-ons.

    return CardService.newCardBuilder()
             .setHeader(CardService.newCardHeader().setTitle("CardTitle"))
             .build();
    

    Or you can return multiple Cards like so:

    return [
      CardService.newCardBuilder().build(),
      CardService.newCardBuilder().build(),
      CardService.newCardBuilder().build()
    ]
    

    The following shows how you could define a card with a header, text, an image and a menu item:

    function createWidgetDemoCard() {
      return CardService
         .newCardBuilder()
         .setHeader(
             CardService.newCardHeader()
                 .setTitle('Widget demonstration')
                 .setSubtitle('Check out these widgets')
                 .setImageStyle(CardService.ImageStyle.SQUARE)
                 .setImageUrl(
                     'https://www.example.com/images/headerImage.png'))
         .addSection(
              CardService.newCardSection()
                  .setHeader('Simple widgets')  // optional
                  .addWidget(CardService.newTextParagraph().setText(
                      'These widgets are display-only. ' +
                      'A text paragraph can have multiple lines and ' +
                      'formatting.'))
                  .addWidget(CardService.newImage().setImageUrl(
                      'https://www.example.com/images/mapsImage.png')))
         .addCardAction(CardService.newCardAction().setText('Gmail').setOpenLink(
             CardService.newOpenLink().setUrl('https://mail.google.com/mail')))
         .build();
    }
    
    interface CardService {
        BorderType: typeof BorderType;
        ComposedEmailType: typeof ComposedEmailType;
        ContentType: typeof GoogleAppsScript.Card_Service.ContentType;
        DisplayStyle: typeof DisplayStyle;
        GridItemLayout: typeof GridItemLayout;
        HorizontalAlignment: typeof GoogleAppsScript.Card_Service.HorizontalAlignment;
        Icon: typeof Icon;
        ImageCropType: typeof ImageCropType;
        ImageStyle: typeof ImageStyle;
        InputType: typeof InputType;
        Interaction: typeof Interaction;
        LoadIndicator: typeof LoadIndicator;
        OnClose: typeof OnClose;
        OpenAs: typeof OpenAs;
        SelectionInputType: typeof SelectionInputType;
        SwitchControlType: typeof SwitchControlType;
        TextButtonStyle: typeof TextButtonStyle;
        UpdateDraftBodyType: typeof UpdateDraftBodyType;
        newAction(): GoogleAppsScript.Card_Service.Action;
        newActionResponseBuilder(): ActionResponseBuilder;
        newAttachment(): GoogleAppsScript.Card_Service.Attachment;
        newAuthorizationAction(): AuthorizationAction;
        newAuthorizationException(): AuthorizationException;
        newBorderStyle(): GoogleAppsScript.Card_Service.BorderStyle;
        newButtonSet(): GoogleAppsScript.Card_Service.ButtonSet;
        newCalendarEventActionResponseBuilder(): CalendarEventActionResponseBuilder;
        newCardAction(): CardAction;
        newCardBuilder(): CardBuilder;
        newCardHeader(): CardHeader;
        newCardSection(): CardSection;
        newComposeActionResponseBuilder(): ComposeActionResponseBuilder;
        newDatePicker(): DatePicker;
        newDateTimePicker(): DateTimePicker;
        newDecoratedText(): DecoratedText;
        newDivider(): Divider;
        newDriveItemsSelectedActionResponseBuilder(): DriveItemsSelectedActionResponseBuilder;
        newEditorFileScopeActionResponseBuilder(): EditorFileScopeActionResponseBuilder;
        newFixedFooter(): FixedFooter;
        newGrid(): Grid;
        newGridItem(): GoogleAppsScript.Card_Service.GridItem;
        newIconImage(): IconImage;
        newImage(): GoogleAppsScript.Card_Service.Image;
        newImageButton(): ImageButton;
        newImageComponent(): ImageComponent;
        newImageCropStyle(): ImageCropStyle;
        newKeyValue(): KeyValue;
        newLinkPreview(): LinkPreview;
        newMaterialIcon(): MaterialIcon;
        newNavigation(): Navigation;
        newNotification(): GoogleAppsScript.Card_Service.Notification;
        newOpenLink(): OpenLink;
        newSelectionInput(): SelectionInput;
        newSuggestions(): Suggestions;
        newSuggestionsResponseBuilder(): SuggestionsResponseBuilder;
        newSwitch(): Switch;
        newTextButton(): TextButton;
        newTextInput(): GoogleAppsScript.Card_Service.TextInput;
        newTextParagraph(): TextParagraph;
        newTimePicker(): TimePicker;
        newUniversalActionResponseBuilder(): UniversalActionResponseBuilder;
        newUpdateDraftActionResponseBuilder(): UpdateDraftActionResponseBuilder;
        newUpdateDraftBccRecipientsAction(): UpdateDraftBccRecipientsAction;
        newUpdateDraftBodyAction(): UpdateDraftBodyAction;
        newUpdateDraftCcRecipientsAction(): UpdateDraftCcRecipientsAction;
        newUpdateDraftSubjectAction(): UpdateDraftSubjectAction;
        newUpdateDraftToRecipientsAction(): UpdateDraftToRecipientsAction;
        newValidation(): Validation;
    }
    Index

    Properties

    BorderType: typeof BorderType
    ComposedEmailType: typeof ComposedEmailType
    DisplayStyle: typeof DisplayStyle
    GridItemLayout: typeof GridItemLayout
    Icon: typeof Icon
    ImageCropType: typeof ImageCropType
    ImageStyle: typeof ImageStyle
    InputType: typeof InputType
    Interaction: typeof Interaction
    LoadIndicator: typeof LoadIndicator
    OnClose: typeof OnClose
    OpenAs: typeof OpenAs
    SelectionInputType: typeof SelectionInputType
    SwitchControlType: typeof SwitchControlType
    TextButtonStyle: typeof TextButtonStyle
    UpdateDraftBodyType: typeof UpdateDraftBodyType

    Methods