0
0
Google Sheetsspreadsheet~10 mins

Creating custom menus in Google Sheets - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a custom menu in Google Sheets.

Google Sheets
function onOpen() {
  var ui = SpreadsheetApp.getUi();
  ui.createMenu('[1]')
    .addItem('Show Alert', 'showAlert')
    .addToUi();
}
Drag options to blanks, or click blank then click option'
ACustom Menu
BMy Menu
CMenu
DSheet Menu
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put the menu name in quotes.
Using a variable name instead of a string.
Leaving the menu name blank.
2fill in blank
medium

Complete the code to add a menu item that calls the function 'showAlert'.

Google Sheets
ui.createMenu('Custom Menu')
  .addItem('[1]', 'showAlert')
  .addToUi();
Drag options to blanks, or click blank then click option'
AShowMessage
BAlert
CShow Alert
DDisplay Alert
Attempts:
3 left
💡 Hint
Common Mistakes
Using the function name instead of a descriptive label.
Leaving the menu item name empty.
Using inconsistent naming.
3fill in blank
hard

Fix the error in the code to properly add the custom menu when the spreadsheet opens.

Google Sheets
function onOpen() {
  var ui = SpreadsheetApp.getUi()
  ui.createMenu('Custom Menu')
    .addItem('Show Alert', [1])
    .addToUi();
}
Drag options to blanks, or click blank then click option'
A"showAlert"
B'showAlert'
CshowAlert
DshowAlert()
Attempts:
3 left
💡 Hint
Common Mistakes
Calling the function instead of passing its name as a string.
Using no quotes or wrong quotes.
Adding parentheses after the function name.
4fill in blank
hard

Fill both blanks to create a menu with two items calling different functions.

Google Sheets
function onOpen() {
  var ui = SpreadsheetApp.getUi();
  ui.createMenu('Custom Menu')
    .addItem('[1]', 'showAlert')
    .addItem('[2]', 'showPrompt')
    .addToUi();
}
Drag options to blanks, or click blank then click option'
AShow Alert
BShow Prompt
CAlert
DPrompt
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the menu item names.
Using function names instead of descriptive labels.
Leaving blanks empty.
5fill in blank
hard

Fill all three blanks to create a menu with three items and correct function names.

Google Sheets
function onOpen() {
  var ui = SpreadsheetApp.getUi();
  ui.createMenu('[1]')
    .addItem('Show Alert', '[2]')
    .addItem('Show Prompt', '[3]')
    .addToUi();
}
Drag options to blanks, or click blank then click option'
ACustom Menu
BshowAlert
CshowPrompt
DMain Menu
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting function names.
Using wrong menu names.
Mixing function names and menu labels.