Creates a clickable text button for a card.
class CardService method .newTextButton()
CardService is the Apps Script service.
.newTextButton() is the method name you will see after a dot in your code.
What it does
Why it's used
- Add a clickable action on an add-on card.
- Let users approve, snooze, or open a sheet from Gmail.
Common errors
- Forgetting parentheses on newTextButton. Write CardService.newTextButton(), not CardService.newTextButton or newTextButton by itself.
- Skipping dots between chained calls. Each step needs a dot, like CardService.newTextButton().
- Adding spaces where they do not belong. Write CardService.newTextButton(), not CardService .newTextButton(), CardService.newTextButton (), or CardService . newTextButton().
- Wrong capitalization. Use CardService and newTextButton, not cardservice or newtextbutton.
Explore
Related methods
-
.newTextParagraph()
Creates a block of text for a card.
-
.newAction()
Defines what happens when a card button is clicked.
-
.newCardBuilder()
Starts building a card UI for a Workspace add-on.
-
.newNavigation()
Defines navigation between cards in an add-on.
More Apps Script
Better Sheets tutorials
No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.