0
0
Google Sheetsspreadsheet~20 mins

Script editor overview in Google Sheets - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Script Editor Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the main purpose of the Script Editor in Google Sheets?

The Script Editor in Google Sheets allows you to:

ASort and filter data within the spreadsheet
BChange the font and color of cells in the spreadsheet
CCreate charts and graphs from your data
DWrite and run custom scripts to automate tasks and add new features
Attempts:
2 left
💡 Hint

Think about what scripting means and how it can help with repetitive tasks.

📊 Formula Result
intermediate
2:00remaining
What will this simple script output in the Logger?

Consider this Google Apps Script code run from the Script Editor:

function logSum() {
  var a = 5;
  var b = 7;
  Logger.log(a + b);
}

What will appear in the Logs after running logSum()?

A12
B57
Ca + b
DError: Logger is undefined
Attempts:
2 left
💡 Hint

Logger.log prints the value of the expression inside the parentheses.

Function Choice
advanced
2:00remaining
Which function correctly gets the active spreadsheet in Google Sheets Script Editor?

You want to write a script that works on the currently open spreadsheet. Which function should you use?

ASpreadsheetApp.getActiveSpreadsheet()
BSpreadsheetApp.openById()
CSpreadsheetApp.getUi()
DSpreadsheetApp.create()
Attempts:
2 left
💡 Hint

Think about which function returns the spreadsheet you are currently working on.

🎯 Scenario
advanced
2:00remaining
You want to create a custom menu in Google Sheets using the Script Editor. Which method adds a new menu to the spreadsheet UI?

Which method should you use to add a custom menu to the Google Sheets interface?

ASpreadsheetApp.createMenu('My Menu').addItem('Say Hello', 'myFunction')
BSpreadsheetApp.getUi().createMenu('My Menu').addItem('Say Hello', 'myFunction').addToUi()
CSpreadsheetApp.getActiveSpreadsheet().addMenu('My Menu')
DSpreadsheetApp.getUi().addMenu('My Menu')
Attempts:
2 left
💡 Hint

Menus are part of the user interface, so you need to get the UI first.

data_analysis
expert
2:00remaining
What will be the value of cell A1 after running this script?

Given this script run from the Script Editor:

function writeValue() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  sheet.getRange('A1').setValue('Hello');
  sheet.getRange('A1').setValue(sheet.getRange('A1').getValue() + ' World');
}

What will cell A1 contain after writeValue() runs?

AWorld
BHello
CHello World
DError: Cannot concatenate values
Attempts:
2 left
💡 Hint

Look at how the script reads and updates the cell value step by step.